date-and-time 3.5.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -1
- package/README.md +1120 -435
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +440 -0
- package/dist/index.js +2 -0
- package/dist/locales/ar.cjs +1 -0
- package/dist/locales/ar.js +1 -0
- package/dist/locales/az.cjs +1 -0
- package/dist/locales/az.js +1 -0
- package/dist/locales/bn.cjs +1 -0
- package/dist/locales/bn.js +1 -0
- package/dist/locales/cs.cjs +1 -0
- package/dist/locales/cs.js +1 -0
- package/dist/locales/da.cjs +1 -0
- package/dist/locales/da.js +1 -0
- package/dist/locales/de.cjs +1 -0
- package/dist/locales/de.js +1 -0
- package/dist/locales/el.cjs +1 -0
- package/dist/locales/el.js +1 -0
- package/dist/locales/en.cjs +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/es.cjs +1 -0
- package/dist/locales/es.js +1 -0
- package/dist/locales/fa.cjs +1 -0
- package/dist/locales/fa.js +1 -0
- package/dist/locales/fi.cjs +1 -0
- package/dist/locales/fi.js +1 -0
- package/dist/locales/fr.cjs +1 -0
- package/dist/locales/fr.js +1 -0
- package/dist/locales/he.cjs +1 -0
- package/dist/locales/he.js +1 -0
- package/dist/locales/hi.cjs +1 -0
- package/dist/locales/hi.js +1 -0
- package/dist/locales/hu.cjs +1 -0
- package/dist/locales/hu.js +1 -0
- package/dist/locales/id.cjs +1 -0
- package/dist/locales/id.js +1 -0
- package/dist/locales/it.cjs +1 -0
- package/dist/locales/it.js +1 -0
- package/dist/locales/ja.cjs +1 -0
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ko.cjs +1 -0
- package/dist/locales/ko.js +1 -0
- package/dist/locales/ms.cjs +1 -0
- package/dist/locales/ms.js +1 -0
- package/dist/locales/my.cjs +1 -0
- package/dist/locales/my.js +1 -0
- package/dist/locales/nl.cjs +1 -0
- package/dist/locales/nl.js +1 -0
- package/dist/locales/no.cjs +1 -0
- package/dist/locales/no.js +1 -0
- package/dist/locales/pl.cjs +1 -0
- package/dist/locales/pl.js +1 -0
- package/dist/locales/pt-BR.cjs +1 -0
- package/dist/locales/pt-BR.js +1 -0
- package/dist/locales/pt-PT.cjs +1 -0
- package/dist/locales/pt-PT.js +1 -0
- package/dist/locales/ro.cjs +1 -0
- package/dist/locales/ro.js +1 -0
- package/dist/locales/ru.cjs +1 -0
- package/dist/locales/ru.js +1 -0
- package/dist/locales/rw.cjs +1 -0
- package/dist/locales/rw.js +1 -0
- package/dist/locales/sr-Cyrl.cjs +1 -0
- package/dist/locales/sr-Cyrl.js +1 -0
- package/dist/locales/sr-Latn.cjs +1 -0
- package/dist/locales/sr-Latn.js +1 -0
- package/dist/locales/sv.cjs +1 -0
- package/dist/locales/sv.js +1 -0
- package/dist/locales/ta.cjs +1 -0
- package/dist/locales/ta.js +1 -0
- package/dist/locales/th.cjs +1 -0
- package/dist/locales/th.js +1 -0
- package/dist/locales/tr.cjs +1 -0
- package/dist/locales/tr.js +1 -0
- package/dist/locales/uk.cjs +1 -0
- package/dist/locales/uk.js +1 -0
- package/dist/locales/uz-Cyrl.cjs +1 -0
- package/dist/locales/uz-Cyrl.js +1 -0
- package/dist/locales/uz-Latn.cjs +1 -0
- package/dist/locales/uz-Latn.js +1 -0
- package/dist/locales/vi.cjs +1 -0
- package/dist/locales/vi.js +1 -0
- package/dist/locales/zh-Hans.cjs +1 -0
- package/dist/locales/zh-Hans.js +1 -0
- package/dist/locales/zh-Hant.cjs +1 -0
- package/dist/locales/zh-Hant.js +1 -0
- package/dist/numerals/arab.cjs +1 -0
- package/dist/numerals/arab.js +1 -0
- package/dist/numerals/arabext.cjs +1 -0
- package/dist/numerals/arabext.js +1 -0
- package/dist/numerals/beng.cjs +1 -0
- package/dist/numerals/beng.js +1 -0
- package/dist/numerals/latn.cjs +1 -0
- package/dist/numerals/latn.js +1 -0
- package/dist/numerals/mymr.cjs +1 -0
- package/dist/numerals/mymr.js +1 -0
- package/dist/plugin.cjs +1 -0
- package/dist/plugin.d.ts +180 -0
- package/dist/plugin.js +1 -0
- package/dist/plugins/day-of-week.cjs +1 -0
- package/dist/plugins/day-of-week.d.ts +84 -0
- package/dist/plugins/day-of-week.js +1 -0
- package/dist/plugins/microsecond.cjs +1 -0
- package/dist/plugins/microsecond.d.ts +111 -0
- package/dist/plugins/microsecond.js +1 -0
- package/dist/plugins/nanosecond.cjs +1 -0
- package/dist/plugins/nanosecond.d.ts +111 -0
- package/dist/plugins/nanosecond.js +1 -0
- package/dist/plugins/ordinal.cjs +1 -0
- package/dist/plugins/ordinal.d.ts +172 -0
- package/dist/plugins/ordinal.js +1 -0
- package/dist/plugins/two-digit-year.cjs +1 -0
- package/dist/plugins/two-digit-year.d.ts +86 -0
- package/dist/plugins/two-digit-year.js +1 -0
- package/dist/plugins/zonename.cjs +1 -0
- package/dist/plugins/zonename.d.ts +114 -0
- package/dist/plugins/zonename.js +1 -0
- package/dist/timezones/Africa/Abidjan.cjs +1 -0
- package/dist/timezones/Africa/Abidjan.js +1 -0
- package/dist/timezones/Africa/Accra.cjs +1 -0
- package/dist/timezones/Africa/Accra.js +1 -0
- package/dist/timezones/Africa/Addis_Ababa.cjs +1 -0
- package/dist/timezones/Africa/Addis_Ababa.js +1 -0
- package/dist/timezones/Africa/Algiers.cjs +1 -0
- package/dist/timezones/Africa/Algiers.js +1 -0
- package/dist/timezones/Africa/Asmara.cjs +1 -0
- package/dist/timezones/Africa/Asmara.js +1 -0
- package/dist/timezones/Africa/Bamako.cjs +1 -0
- package/dist/timezones/Africa/Bamako.js +1 -0
- package/dist/timezones/Africa/Bangui.cjs +1 -0
- package/dist/timezones/Africa/Bangui.js +1 -0
- package/dist/timezones/Africa/Banjul.cjs +1 -0
- package/dist/timezones/Africa/Banjul.js +1 -0
- package/dist/timezones/Africa/Bissau.cjs +1 -0
- package/dist/timezones/Africa/Bissau.js +1 -0
- package/dist/timezones/Africa/Blantyre.cjs +1 -0
- package/dist/timezones/Africa/Blantyre.js +1 -0
- package/dist/timezones/Africa/Brazzaville.cjs +1 -0
- package/dist/timezones/Africa/Brazzaville.js +1 -0
- package/dist/timezones/Africa/Bujumbura.cjs +1 -0
- package/dist/timezones/Africa/Bujumbura.js +1 -0
- package/dist/timezones/Africa/Cairo.cjs +1 -0
- package/dist/timezones/Africa/Cairo.js +1 -0
- package/dist/timezones/Africa/Casablanca.cjs +1 -0
- package/dist/timezones/Africa/Casablanca.js +1 -0
- package/dist/timezones/Africa/Ceuta.cjs +1 -0
- package/dist/timezones/Africa/Ceuta.js +1 -0
- package/dist/timezones/Africa/Conakry.cjs +1 -0
- package/dist/timezones/Africa/Conakry.js +1 -0
- package/dist/timezones/Africa/Dakar.cjs +1 -0
- package/dist/timezones/Africa/Dakar.js +1 -0
- package/dist/timezones/Africa/Dar_es_Salaam.cjs +1 -0
- package/dist/timezones/Africa/Dar_es_Salaam.js +1 -0
- package/dist/timezones/Africa/Djibouti.cjs +1 -0
- package/dist/timezones/Africa/Djibouti.js +1 -0
- package/dist/timezones/Africa/Douala.cjs +1 -0
- package/dist/timezones/Africa/Douala.js +1 -0
- package/dist/timezones/Africa/El_Aaiun.cjs +1 -0
- package/dist/timezones/Africa/El_Aaiun.js +1 -0
- package/dist/timezones/Africa/Freetown.cjs +1 -0
- package/dist/timezones/Africa/Freetown.js +1 -0
- package/dist/timezones/Africa/Gaborone.cjs +1 -0
- package/dist/timezones/Africa/Gaborone.js +1 -0
- package/dist/timezones/Africa/Harare.cjs +1 -0
- package/dist/timezones/Africa/Harare.js +1 -0
- package/dist/timezones/Africa/Johannesburg.cjs +1 -0
- package/dist/timezones/Africa/Johannesburg.js +1 -0
- package/dist/timezones/Africa/Juba.cjs +1 -0
- package/dist/timezones/Africa/Juba.js +1 -0
- package/dist/timezones/Africa/Kampala.cjs +1 -0
- package/dist/timezones/Africa/Kampala.js +1 -0
- package/dist/timezones/Africa/Khartoum.cjs +1 -0
- package/dist/timezones/Africa/Khartoum.js +1 -0
- package/dist/timezones/Africa/Kigali.cjs +1 -0
- package/dist/timezones/Africa/Kigali.js +1 -0
- package/dist/timezones/Africa/Kinshasa.cjs +1 -0
- package/dist/timezones/Africa/Kinshasa.js +1 -0
- package/dist/timezones/Africa/Lagos.cjs +1 -0
- package/dist/timezones/Africa/Lagos.js +1 -0
- package/dist/timezones/Africa/Libreville.cjs +1 -0
- package/dist/timezones/Africa/Libreville.js +1 -0
- package/dist/timezones/Africa/Lome.cjs +1 -0
- package/dist/timezones/Africa/Lome.js +1 -0
- package/dist/timezones/Africa/Luanda.cjs +1 -0
- package/dist/timezones/Africa/Luanda.js +1 -0
- package/dist/timezones/Africa/Lubumbashi.cjs +1 -0
- package/dist/timezones/Africa/Lubumbashi.js +1 -0
- package/dist/timezones/Africa/Lusaka.cjs +1 -0
- package/dist/timezones/Africa/Lusaka.js +1 -0
- package/dist/timezones/Africa/Malabo.cjs +1 -0
- package/dist/timezones/Africa/Malabo.js +1 -0
- package/dist/timezones/Africa/Maputo.cjs +1 -0
- package/dist/timezones/Africa/Maputo.js +1 -0
- package/dist/timezones/Africa/Maseru.cjs +1 -0
- package/dist/timezones/Africa/Maseru.js +1 -0
- package/dist/timezones/Africa/Mbabane.cjs +1 -0
- package/dist/timezones/Africa/Mbabane.js +1 -0
- package/dist/timezones/Africa/Mogadishu.cjs +1 -0
- package/dist/timezones/Africa/Mogadishu.js +1 -0
- package/dist/timezones/Africa/Monrovia.cjs +1 -0
- package/dist/timezones/Africa/Monrovia.js +1 -0
- package/dist/timezones/Africa/Nairobi.cjs +1 -0
- package/dist/timezones/Africa/Nairobi.js +1 -0
- package/dist/timezones/Africa/Ndjamena.cjs +1 -0
- package/dist/timezones/Africa/Ndjamena.js +1 -0
- package/dist/timezones/Africa/Niamey.cjs +1 -0
- package/dist/timezones/Africa/Niamey.js +1 -0
- package/dist/timezones/Africa/Nouakchott.cjs +1 -0
- package/dist/timezones/Africa/Nouakchott.js +1 -0
- package/dist/timezones/Africa/Ouagadougou.cjs +1 -0
- package/dist/timezones/Africa/Ouagadougou.js +1 -0
- package/dist/timezones/Africa/Porto-Novo.cjs +1 -0
- package/dist/timezones/Africa/Porto-Novo.js +1 -0
- package/dist/timezones/Africa/Sao_Tome.cjs +1 -0
- package/dist/timezones/Africa/Sao_Tome.js +1 -0
- package/dist/timezones/Africa/Tripoli.cjs +1 -0
- package/dist/timezones/Africa/Tripoli.js +1 -0
- package/dist/timezones/Africa/Tunis.cjs +1 -0
- package/dist/timezones/Africa/Tunis.js +1 -0
- package/dist/timezones/Africa/Windhoek.cjs +1 -0
- package/dist/timezones/Africa/Windhoek.js +1 -0
- package/dist/timezones/America/Adak.cjs +1 -0
- package/dist/timezones/America/Adak.js +1 -0
- package/dist/timezones/America/Anchorage.cjs +1 -0
- package/dist/timezones/America/Anchorage.js +1 -0
- package/dist/timezones/America/Anguilla.cjs +1 -0
- package/dist/timezones/America/Anguilla.js +1 -0
- package/dist/timezones/America/Antigua.cjs +1 -0
- package/dist/timezones/America/Antigua.js +1 -0
- package/dist/timezones/America/Araguaina.cjs +1 -0
- package/dist/timezones/America/Araguaina.js +1 -0
- package/dist/timezones/America/Argentina/Buenos_Aires.cjs +1 -0
- package/dist/timezones/America/Argentina/Buenos_Aires.js +1 -0
- package/dist/timezones/America/Argentina/Catamarca.cjs +1 -0
- package/dist/timezones/America/Argentina/Catamarca.js +1 -0
- package/dist/timezones/America/Argentina/Cordoba.cjs +1 -0
- package/dist/timezones/America/Argentina/Cordoba.js +1 -0
- package/dist/timezones/America/Argentina/Jujuy.cjs +1 -0
- package/dist/timezones/America/Argentina/Jujuy.js +1 -0
- package/dist/timezones/America/Argentina/La_Rioja.cjs +1 -0
- package/dist/timezones/America/Argentina/La_Rioja.js +1 -0
- package/dist/timezones/America/Argentina/Mendoza.cjs +1 -0
- package/dist/timezones/America/Argentina/Mendoza.js +1 -0
- package/dist/timezones/America/Argentina/Rio_Gallegos.cjs +1 -0
- package/dist/timezones/America/Argentina/Rio_Gallegos.js +1 -0
- package/dist/timezones/America/Argentina/Salta.cjs +1 -0
- package/dist/timezones/America/Argentina/Salta.js +1 -0
- package/dist/timezones/America/Argentina/San_Juan.cjs +1 -0
- package/dist/timezones/America/Argentina/San_Juan.js +1 -0
- package/dist/timezones/America/Argentina/San_Luis.cjs +1 -0
- package/dist/timezones/America/Argentina/San_Luis.js +1 -0
- package/dist/timezones/America/Argentina/Tucuman.cjs +1 -0
- package/dist/timezones/America/Argentina/Tucuman.js +1 -0
- package/dist/timezones/America/Argentina/Ushuaia.cjs +1 -0
- package/dist/timezones/America/Argentina/Ushuaia.js +1 -0
- package/dist/timezones/America/Aruba.cjs +1 -0
- package/dist/timezones/America/Aruba.js +1 -0
- package/dist/timezones/America/Asuncion.cjs +1 -0
- package/dist/timezones/America/Asuncion.js +1 -0
- package/dist/timezones/America/Atikokan.cjs +1 -0
- package/dist/timezones/America/Atikokan.js +1 -0
- package/dist/timezones/America/Bahia.cjs +1 -0
- package/dist/timezones/America/Bahia.js +1 -0
- package/dist/timezones/America/Bahia_Banderas.cjs +1 -0
- package/dist/timezones/America/Bahia_Banderas.js +1 -0
- package/dist/timezones/America/Barbados.cjs +1 -0
- package/dist/timezones/America/Barbados.js +1 -0
- package/dist/timezones/America/Belem.cjs +1 -0
- package/dist/timezones/America/Belem.js +1 -0
- package/dist/timezones/America/Belize.cjs +1 -0
- package/dist/timezones/America/Belize.js +1 -0
- package/dist/timezones/America/Blanc-Sablon.cjs +1 -0
- package/dist/timezones/America/Blanc-Sablon.js +1 -0
- package/dist/timezones/America/Boa_Vista.cjs +1 -0
- package/dist/timezones/America/Boa_Vista.js +1 -0
- package/dist/timezones/America/Bogota.cjs +1 -0
- package/dist/timezones/America/Bogota.js +1 -0
- package/dist/timezones/America/Boise.cjs +1 -0
- package/dist/timezones/America/Boise.js +1 -0
- package/dist/timezones/America/Cambridge_Bay.cjs +1 -0
- package/dist/timezones/America/Cambridge_Bay.js +1 -0
- package/dist/timezones/America/Campo_Grande.cjs +1 -0
- package/dist/timezones/America/Campo_Grande.js +1 -0
- package/dist/timezones/America/Cancun.cjs +1 -0
- package/dist/timezones/America/Cancun.js +1 -0
- package/dist/timezones/America/Caracas.cjs +1 -0
- package/dist/timezones/America/Caracas.js +1 -0
- package/dist/timezones/America/Cayenne.cjs +1 -0
- package/dist/timezones/America/Cayenne.js +1 -0
- package/dist/timezones/America/Cayman.cjs +1 -0
- package/dist/timezones/America/Cayman.js +1 -0
- package/dist/timezones/America/Chicago.cjs +1 -0
- package/dist/timezones/America/Chicago.js +1 -0
- package/dist/timezones/America/Chihuahua.cjs +1 -0
- package/dist/timezones/America/Chihuahua.js +1 -0
- package/dist/timezones/America/Ciudad_Juarez.cjs +1 -0
- package/dist/timezones/America/Ciudad_Juarez.js +1 -0
- package/dist/timezones/America/Costa_Rica.cjs +1 -0
- package/dist/timezones/America/Costa_Rica.js +1 -0
- package/dist/timezones/America/Coyhaique.cjs +1 -0
- package/dist/timezones/America/Coyhaique.js +1 -0
- package/dist/timezones/America/Creston.cjs +1 -0
- package/dist/timezones/America/Creston.js +1 -0
- package/dist/timezones/America/Cuiaba.cjs +1 -0
- package/dist/timezones/America/Cuiaba.js +1 -0
- package/dist/timezones/America/Curacao.cjs +1 -0
- package/dist/timezones/America/Curacao.js +1 -0
- package/dist/timezones/America/Danmarkshavn.cjs +1 -0
- package/dist/timezones/America/Danmarkshavn.js +1 -0
- package/dist/timezones/America/Dawson.cjs +1 -0
- package/dist/timezones/America/Dawson.js +1 -0
- package/dist/timezones/America/Dawson_Creek.cjs +1 -0
- package/dist/timezones/America/Dawson_Creek.js +1 -0
- package/dist/timezones/America/Denver.cjs +1 -0
- package/dist/timezones/America/Denver.js +1 -0
- package/dist/timezones/America/Detroit.cjs +1 -0
- package/dist/timezones/America/Detroit.js +1 -0
- package/dist/timezones/America/Dominica.cjs +1 -0
- package/dist/timezones/America/Dominica.js +1 -0
- package/dist/timezones/America/Edmonton.cjs +1 -0
- package/dist/timezones/America/Edmonton.js +1 -0
- package/dist/timezones/America/Eirunepe.cjs +1 -0
- package/dist/timezones/America/Eirunepe.js +1 -0
- package/dist/timezones/America/El_Salvador.cjs +1 -0
- package/dist/timezones/America/El_Salvador.js +1 -0
- package/dist/timezones/America/Fort_Nelson.cjs +1 -0
- package/dist/timezones/America/Fort_Nelson.js +1 -0
- package/dist/timezones/America/Fortaleza.cjs +1 -0
- package/dist/timezones/America/Fortaleza.js +1 -0
- package/dist/timezones/America/Glace_Bay.cjs +1 -0
- package/dist/timezones/America/Glace_Bay.js +1 -0
- package/dist/timezones/America/Goose_Bay.cjs +1 -0
- package/dist/timezones/America/Goose_Bay.js +1 -0
- package/dist/timezones/America/Grand_Turk.cjs +1 -0
- package/dist/timezones/America/Grand_Turk.js +1 -0
- package/dist/timezones/America/Grenada.cjs +1 -0
- package/dist/timezones/America/Grenada.js +1 -0
- package/dist/timezones/America/Guadeloupe.cjs +1 -0
- package/dist/timezones/America/Guadeloupe.js +1 -0
- package/dist/timezones/America/Guatemala.cjs +1 -0
- package/dist/timezones/America/Guatemala.js +1 -0
- package/dist/timezones/America/Guayaquil.cjs +1 -0
- package/dist/timezones/America/Guayaquil.js +1 -0
- package/dist/timezones/America/Guyana.cjs +1 -0
- package/dist/timezones/America/Guyana.js +1 -0
- package/dist/timezones/America/Halifax.cjs +1 -0
- package/dist/timezones/America/Halifax.js +1 -0
- package/dist/timezones/America/Havana.cjs +1 -0
- package/dist/timezones/America/Havana.js +1 -0
- package/dist/timezones/America/Hermosillo.cjs +1 -0
- package/dist/timezones/America/Hermosillo.js +1 -0
- package/dist/timezones/America/Indiana/Indianapolis.cjs +1 -0
- package/dist/timezones/America/Indiana/Indianapolis.js +1 -0
- package/dist/timezones/America/Indiana/Knox.cjs +1 -0
- package/dist/timezones/America/Indiana/Knox.js +1 -0
- package/dist/timezones/America/Indiana/Marengo.cjs +1 -0
- package/dist/timezones/America/Indiana/Marengo.js +1 -0
- package/dist/timezones/America/Indiana/Petersburg.cjs +1 -0
- package/dist/timezones/America/Indiana/Petersburg.js +1 -0
- package/dist/timezones/America/Indiana/Tell_City.cjs +1 -0
- package/dist/timezones/America/Indiana/Tell_City.js +1 -0
- package/dist/timezones/America/Indiana/Vevay.cjs +1 -0
- package/dist/timezones/America/Indiana/Vevay.js +1 -0
- package/dist/timezones/America/Indiana/Vincennes.cjs +1 -0
- package/dist/timezones/America/Indiana/Vincennes.js +1 -0
- package/dist/timezones/America/Indiana/Winamac.cjs +1 -0
- package/dist/timezones/America/Indiana/Winamac.js +1 -0
- package/dist/timezones/America/Inuvik.cjs +1 -0
- package/dist/timezones/America/Inuvik.js +1 -0
- package/dist/timezones/America/Iqaluit.cjs +1 -0
- package/dist/timezones/America/Iqaluit.js +1 -0
- package/dist/timezones/America/Jamaica.cjs +1 -0
- package/dist/timezones/America/Jamaica.js +1 -0
- package/dist/timezones/America/Juneau.cjs +1 -0
- package/dist/timezones/America/Juneau.js +1 -0
- package/dist/timezones/America/Kentucky/Louisville.cjs +1 -0
- package/dist/timezones/America/Kentucky/Louisville.js +1 -0
- package/dist/timezones/America/Kentucky/Monticello.cjs +1 -0
- package/dist/timezones/America/Kentucky/Monticello.js +1 -0
- package/dist/timezones/America/Kralendijk.cjs +1 -0
- package/dist/timezones/America/Kralendijk.js +1 -0
- package/dist/timezones/America/La_Paz.cjs +1 -0
- package/dist/timezones/America/La_Paz.js +1 -0
- package/dist/timezones/America/Lima.cjs +1 -0
- package/dist/timezones/America/Lima.js +1 -0
- package/dist/timezones/America/Los_Angeles.cjs +1 -0
- package/dist/timezones/America/Los_Angeles.js +1 -0
- package/dist/timezones/America/Lower_Princes.cjs +1 -0
- package/dist/timezones/America/Lower_Princes.js +1 -0
- package/dist/timezones/America/Maceio.cjs +1 -0
- package/dist/timezones/America/Maceio.js +1 -0
- package/dist/timezones/America/Managua.cjs +1 -0
- package/dist/timezones/America/Managua.js +1 -0
- package/dist/timezones/America/Manaus.cjs +1 -0
- package/dist/timezones/America/Manaus.js +1 -0
- package/dist/timezones/America/Marigot.cjs +1 -0
- package/dist/timezones/America/Marigot.js +1 -0
- package/dist/timezones/America/Martinique.cjs +1 -0
- package/dist/timezones/America/Martinique.js +1 -0
- package/dist/timezones/America/Matamoros.cjs +1 -0
- package/dist/timezones/America/Matamoros.js +1 -0
- package/dist/timezones/America/Mazatlan.cjs +1 -0
- package/dist/timezones/America/Mazatlan.js +1 -0
- package/dist/timezones/America/Menominee.cjs +1 -0
- package/dist/timezones/America/Menominee.js +1 -0
- package/dist/timezones/America/Merida.cjs +1 -0
- package/dist/timezones/America/Merida.js +1 -0
- package/dist/timezones/America/Metlakatla.cjs +1 -0
- package/dist/timezones/America/Metlakatla.js +1 -0
- package/dist/timezones/America/Mexico_City.cjs +1 -0
- package/dist/timezones/America/Mexico_City.js +1 -0
- package/dist/timezones/America/Miquelon.cjs +1 -0
- package/dist/timezones/America/Miquelon.js +1 -0
- package/dist/timezones/America/Moncton.cjs +1 -0
- package/dist/timezones/America/Moncton.js +1 -0
- package/dist/timezones/America/Monterrey.cjs +1 -0
- package/dist/timezones/America/Monterrey.js +1 -0
- package/dist/timezones/America/Montevideo.cjs +1 -0
- package/dist/timezones/America/Montevideo.js +1 -0
- package/dist/timezones/America/Montserrat.cjs +1 -0
- package/dist/timezones/America/Montserrat.js +1 -0
- package/dist/timezones/America/Nassau.cjs +1 -0
- package/dist/timezones/America/Nassau.js +1 -0
- package/dist/timezones/America/New_York.cjs +1 -0
- package/dist/timezones/America/New_York.js +1 -0
- package/dist/timezones/America/Nome.cjs +1 -0
- package/dist/timezones/America/Nome.js +1 -0
- package/dist/timezones/America/Noronha.cjs +1 -0
- package/dist/timezones/America/Noronha.js +1 -0
- package/dist/timezones/America/North_Dakota/Beulah.cjs +1 -0
- package/dist/timezones/America/North_Dakota/Beulah.js +1 -0
- package/dist/timezones/America/North_Dakota/Center.cjs +1 -0
- package/dist/timezones/America/North_Dakota/Center.js +1 -0
- package/dist/timezones/America/North_Dakota/New_Salem.cjs +1 -0
- package/dist/timezones/America/North_Dakota/New_Salem.js +1 -0
- package/dist/timezones/America/Nuuk.cjs +1 -0
- package/dist/timezones/America/Nuuk.js +1 -0
- package/dist/timezones/America/Ojinaga.cjs +1 -0
- package/dist/timezones/America/Ojinaga.js +1 -0
- package/dist/timezones/America/Panama.cjs +1 -0
- package/dist/timezones/America/Panama.js +1 -0
- package/dist/timezones/America/Paramaribo.cjs +1 -0
- package/dist/timezones/America/Paramaribo.js +1 -0
- package/dist/timezones/America/Phoenix.cjs +1 -0
- package/dist/timezones/America/Phoenix.js +1 -0
- package/dist/timezones/America/Port-au-Prince.cjs +1 -0
- package/dist/timezones/America/Port-au-Prince.js +1 -0
- package/dist/timezones/America/Port_of_Spain.cjs +1 -0
- package/dist/timezones/America/Port_of_Spain.js +1 -0
- package/dist/timezones/America/Porto_Velho.cjs +1 -0
- package/dist/timezones/America/Porto_Velho.js +1 -0
- package/dist/timezones/America/Puerto_Rico.cjs +1 -0
- package/dist/timezones/America/Puerto_Rico.js +1 -0
- package/dist/timezones/America/Punta_Arenas.cjs +1 -0
- package/dist/timezones/America/Punta_Arenas.js +1 -0
- package/dist/timezones/America/Rankin_Inlet.cjs +1 -0
- package/dist/timezones/America/Rankin_Inlet.js +1 -0
- package/dist/timezones/America/Recife.cjs +1 -0
- package/dist/timezones/America/Recife.js +1 -0
- package/dist/timezones/America/Regina.cjs +1 -0
- package/dist/timezones/America/Regina.js +1 -0
- package/dist/timezones/America/Resolute.cjs +1 -0
- package/dist/timezones/America/Resolute.js +1 -0
- package/dist/timezones/America/Rio_Branco.cjs +1 -0
- package/dist/timezones/America/Rio_Branco.js +1 -0
- package/dist/timezones/America/Santarem.cjs +1 -0
- package/dist/timezones/America/Santarem.js +1 -0
- package/dist/timezones/America/Santiago.cjs +1 -0
- package/dist/timezones/America/Santiago.js +1 -0
- package/dist/timezones/America/Santo_Domingo.cjs +1 -0
- package/dist/timezones/America/Santo_Domingo.js +1 -0
- package/dist/timezones/America/Sao_Paulo.cjs +1 -0
- package/dist/timezones/America/Sao_Paulo.js +1 -0
- package/dist/timezones/America/Scoresbysund.cjs +1 -0
- package/dist/timezones/America/Scoresbysund.js +1 -0
- package/dist/timezones/America/Sitka.cjs +1 -0
- package/dist/timezones/America/Sitka.js +1 -0
- package/dist/timezones/America/St_Barthelemy.cjs +1 -0
- package/dist/timezones/America/St_Barthelemy.js +1 -0
- package/dist/timezones/America/St_Johns.cjs +1 -0
- package/dist/timezones/America/St_Johns.js +1 -0
- package/dist/timezones/America/St_Kitts.cjs +1 -0
- package/dist/timezones/America/St_Kitts.js +1 -0
- package/dist/timezones/America/St_Lucia.cjs +1 -0
- package/dist/timezones/America/St_Lucia.js +1 -0
- package/dist/timezones/America/St_Thomas.cjs +1 -0
- package/dist/timezones/America/St_Thomas.js +1 -0
- package/dist/timezones/America/St_Vincent.cjs +1 -0
- package/dist/timezones/America/St_Vincent.js +1 -0
- package/dist/timezones/America/Swift_Current.cjs +1 -0
- package/dist/timezones/America/Swift_Current.js +1 -0
- package/dist/timezones/America/Tegucigalpa.cjs +1 -0
- package/dist/timezones/America/Tegucigalpa.js +1 -0
- package/dist/timezones/America/Thule.cjs +1 -0
- package/dist/timezones/America/Thule.js +1 -0
- package/dist/timezones/America/Tijuana.cjs +1 -0
- package/dist/timezones/America/Tijuana.js +1 -0
- package/dist/timezones/America/Toronto.cjs +1 -0
- package/dist/timezones/America/Toronto.js +1 -0
- package/dist/timezones/America/Tortola.cjs +1 -0
- package/dist/timezones/America/Tortola.js +1 -0
- package/dist/timezones/America/Vancouver.cjs +1 -0
- package/dist/timezones/America/Vancouver.js +1 -0
- package/dist/timezones/America/Whitehorse.cjs +1 -0
- package/dist/timezones/America/Whitehorse.js +1 -0
- package/dist/timezones/America/Winnipeg.cjs +1 -0
- package/dist/timezones/America/Winnipeg.js +1 -0
- package/dist/timezones/America/Yakutat.cjs +1 -0
- package/dist/timezones/America/Yakutat.js +1 -0
- package/dist/timezones/Antarctica/Casey.cjs +1 -0
- package/dist/timezones/Antarctica/Casey.js +1 -0
- package/dist/timezones/Antarctica/Davis.cjs +1 -0
- package/dist/timezones/Antarctica/Davis.js +1 -0
- package/dist/timezones/Antarctica/DumontDUrville.cjs +1 -0
- package/dist/timezones/Antarctica/DumontDUrville.js +1 -0
- package/dist/timezones/Antarctica/Macquarie.cjs +1 -0
- package/dist/timezones/Antarctica/Macquarie.js +1 -0
- package/dist/timezones/Antarctica/Mawson.cjs +1 -0
- package/dist/timezones/Antarctica/Mawson.js +1 -0
- package/dist/timezones/Antarctica/McMurdo.cjs +1 -0
- package/dist/timezones/Antarctica/McMurdo.js +1 -0
- package/dist/timezones/Antarctica/Palmer.cjs +1 -0
- package/dist/timezones/Antarctica/Palmer.js +1 -0
- package/dist/timezones/Antarctica/Rothera.cjs +1 -0
- package/dist/timezones/Antarctica/Rothera.js +1 -0
- package/dist/timezones/Antarctica/Syowa.cjs +1 -0
- package/dist/timezones/Antarctica/Syowa.js +1 -0
- package/dist/timezones/Antarctica/Troll.cjs +1 -0
- package/dist/timezones/Antarctica/Troll.js +1 -0
- package/dist/timezones/Antarctica/Vostok.cjs +1 -0
- package/dist/timezones/Antarctica/Vostok.js +1 -0
- package/dist/timezones/Arctic/Longyearbyen.cjs +1 -0
- package/dist/timezones/Arctic/Longyearbyen.js +1 -0
- package/dist/timezones/Asia/Aden.cjs +1 -0
- package/dist/timezones/Asia/Aden.js +1 -0
- package/dist/timezones/Asia/Almaty.cjs +1 -0
- package/dist/timezones/Asia/Almaty.js +1 -0
- package/dist/timezones/Asia/Amman.cjs +1 -0
- package/dist/timezones/Asia/Amman.js +1 -0
- package/dist/timezones/Asia/Anadyr.cjs +1 -0
- package/dist/timezones/Asia/Anadyr.js +1 -0
- package/dist/timezones/Asia/Aqtau.cjs +1 -0
- package/dist/timezones/Asia/Aqtau.js +1 -0
- package/dist/timezones/Asia/Aqtobe.cjs +1 -0
- package/dist/timezones/Asia/Aqtobe.js +1 -0
- package/dist/timezones/Asia/Ashgabat.cjs +1 -0
- package/dist/timezones/Asia/Ashgabat.js +1 -0
- package/dist/timezones/Asia/Atyrau.cjs +1 -0
- package/dist/timezones/Asia/Atyrau.js +1 -0
- package/dist/timezones/Asia/Baghdad.cjs +1 -0
- package/dist/timezones/Asia/Baghdad.js +1 -0
- package/dist/timezones/Asia/Bahrain.cjs +1 -0
- package/dist/timezones/Asia/Bahrain.js +1 -0
- package/dist/timezones/Asia/Baku.cjs +1 -0
- package/dist/timezones/Asia/Baku.js +1 -0
- package/dist/timezones/Asia/Bangkok.cjs +1 -0
- package/dist/timezones/Asia/Bangkok.js +1 -0
- package/dist/timezones/Asia/Barnaul.cjs +1 -0
- package/dist/timezones/Asia/Barnaul.js +1 -0
- package/dist/timezones/Asia/Beirut.cjs +1 -0
- package/dist/timezones/Asia/Beirut.js +1 -0
- package/dist/timezones/Asia/Bishkek.cjs +1 -0
- package/dist/timezones/Asia/Bishkek.js +1 -0
- package/dist/timezones/Asia/Brunei.cjs +1 -0
- package/dist/timezones/Asia/Brunei.js +1 -0
- package/dist/timezones/Asia/Chita.cjs +1 -0
- package/dist/timezones/Asia/Chita.js +1 -0
- package/dist/timezones/Asia/Colombo.cjs +1 -0
- package/dist/timezones/Asia/Colombo.js +1 -0
- package/dist/timezones/Asia/Damascus.cjs +1 -0
- package/dist/timezones/Asia/Damascus.js +1 -0
- package/dist/timezones/Asia/Dhaka.cjs +1 -0
- package/dist/timezones/Asia/Dhaka.js +1 -0
- package/dist/timezones/Asia/Dili.cjs +1 -0
- package/dist/timezones/Asia/Dili.js +1 -0
- package/dist/timezones/Asia/Dubai.cjs +1 -0
- package/dist/timezones/Asia/Dubai.js +1 -0
- package/dist/timezones/Asia/Dushanbe.cjs +1 -0
- package/dist/timezones/Asia/Dushanbe.js +1 -0
- package/dist/timezones/Asia/Famagusta.cjs +1 -0
- package/dist/timezones/Asia/Famagusta.js +1 -0
- package/dist/timezones/Asia/Gaza.cjs +1 -0
- package/dist/timezones/Asia/Gaza.js +1 -0
- package/dist/timezones/Asia/Hebron.cjs +1 -0
- package/dist/timezones/Asia/Hebron.js +1 -0
- package/dist/timezones/Asia/Ho_Chi_Minh.cjs +1 -0
- package/dist/timezones/Asia/Ho_Chi_Minh.js +1 -0
- package/dist/timezones/Asia/Hong_Kong.cjs +1 -0
- package/dist/timezones/Asia/Hong_Kong.js +1 -0
- package/dist/timezones/Asia/Hovd.cjs +1 -0
- package/dist/timezones/Asia/Hovd.js +1 -0
- package/dist/timezones/Asia/Irkutsk.cjs +1 -0
- package/dist/timezones/Asia/Irkutsk.js +1 -0
- package/dist/timezones/Asia/Jakarta.cjs +1 -0
- package/dist/timezones/Asia/Jakarta.js +1 -0
- package/dist/timezones/Asia/Jayapura.cjs +1 -0
- package/dist/timezones/Asia/Jayapura.js +1 -0
- package/dist/timezones/Asia/Jerusalem.cjs +1 -0
- package/dist/timezones/Asia/Jerusalem.js +1 -0
- package/dist/timezones/Asia/Kabul.cjs +1 -0
- package/dist/timezones/Asia/Kabul.js +1 -0
- package/dist/timezones/Asia/Kamchatka.cjs +1 -0
- package/dist/timezones/Asia/Kamchatka.js +1 -0
- package/dist/timezones/Asia/Karachi.cjs +1 -0
- package/dist/timezones/Asia/Karachi.js +1 -0
- package/dist/timezones/Asia/Kathmandu.cjs +1 -0
- package/dist/timezones/Asia/Kathmandu.js +1 -0
- package/dist/timezones/Asia/Khandyga.cjs +1 -0
- package/dist/timezones/Asia/Khandyga.js +1 -0
- package/dist/timezones/Asia/Kolkata.cjs +1 -0
- package/dist/timezones/Asia/Kolkata.js +1 -0
- package/dist/timezones/Asia/Krasnoyarsk.cjs +1 -0
- package/dist/timezones/Asia/Krasnoyarsk.js +1 -0
- package/dist/timezones/Asia/Kuala_Lumpur.cjs +1 -0
- package/dist/timezones/Asia/Kuala_Lumpur.js +1 -0
- package/dist/timezones/Asia/Kuching.cjs +1 -0
- package/dist/timezones/Asia/Kuching.js +1 -0
- package/dist/timezones/Asia/Kuwait.cjs +1 -0
- package/dist/timezones/Asia/Kuwait.js +1 -0
- package/dist/timezones/Asia/Macau.cjs +1 -0
- package/dist/timezones/Asia/Macau.js +1 -0
- package/dist/timezones/Asia/Magadan.cjs +1 -0
- package/dist/timezones/Asia/Magadan.js +1 -0
- package/dist/timezones/Asia/Makassar.cjs +1 -0
- package/dist/timezones/Asia/Makassar.js +1 -0
- package/dist/timezones/Asia/Manila.cjs +1 -0
- package/dist/timezones/Asia/Manila.js +1 -0
- package/dist/timezones/Asia/Muscat.cjs +1 -0
- package/dist/timezones/Asia/Muscat.js +1 -0
- package/dist/timezones/Asia/Nicosia.cjs +1 -0
- package/dist/timezones/Asia/Nicosia.js +1 -0
- package/dist/timezones/Asia/Novokuznetsk.cjs +1 -0
- package/dist/timezones/Asia/Novokuznetsk.js +1 -0
- package/dist/timezones/Asia/Novosibirsk.cjs +1 -0
- package/dist/timezones/Asia/Novosibirsk.js +1 -0
- package/dist/timezones/Asia/Omsk.cjs +1 -0
- package/dist/timezones/Asia/Omsk.js +1 -0
- package/dist/timezones/Asia/Oral.cjs +1 -0
- package/dist/timezones/Asia/Oral.js +1 -0
- package/dist/timezones/Asia/Phnom_Penh.cjs +1 -0
- package/dist/timezones/Asia/Phnom_Penh.js +1 -0
- package/dist/timezones/Asia/Pontianak.cjs +1 -0
- package/dist/timezones/Asia/Pontianak.js +1 -0
- package/dist/timezones/Asia/Pyongyang.cjs +1 -0
- package/dist/timezones/Asia/Pyongyang.js +1 -0
- package/dist/timezones/Asia/Qatar.cjs +1 -0
- package/dist/timezones/Asia/Qatar.js +1 -0
- package/dist/timezones/Asia/Qostanay.cjs +1 -0
- package/dist/timezones/Asia/Qostanay.js +1 -0
- package/dist/timezones/Asia/Qyzylorda.cjs +1 -0
- package/dist/timezones/Asia/Qyzylorda.js +1 -0
- package/dist/timezones/Asia/Riyadh.cjs +1 -0
- package/dist/timezones/Asia/Riyadh.js +1 -0
- package/dist/timezones/Asia/Sakhalin.cjs +1 -0
- package/dist/timezones/Asia/Sakhalin.js +1 -0
- package/dist/timezones/Asia/Samarkand.cjs +1 -0
- package/dist/timezones/Asia/Samarkand.js +1 -0
- package/dist/timezones/Asia/Seoul.cjs +1 -0
- package/dist/timezones/Asia/Seoul.js +1 -0
- package/dist/timezones/Asia/Shanghai.cjs +1 -0
- package/dist/timezones/Asia/Shanghai.js +1 -0
- package/dist/timezones/Asia/Singapore.cjs +1 -0
- package/dist/timezones/Asia/Singapore.js +1 -0
- package/dist/timezones/Asia/Srednekolymsk.cjs +1 -0
- package/dist/timezones/Asia/Srednekolymsk.js +1 -0
- package/dist/timezones/Asia/Taipei.cjs +1 -0
- package/dist/timezones/Asia/Taipei.js +1 -0
- package/dist/timezones/Asia/Tashkent.cjs +1 -0
- package/dist/timezones/Asia/Tashkent.js +1 -0
- package/dist/timezones/Asia/Tbilisi.cjs +1 -0
- package/dist/timezones/Asia/Tbilisi.js +1 -0
- package/dist/timezones/Asia/Tehran.cjs +1 -0
- package/dist/timezones/Asia/Tehran.js +1 -0
- package/dist/timezones/Asia/Thimphu.cjs +1 -0
- package/dist/timezones/Asia/Thimphu.js +1 -0
- package/dist/timezones/Asia/Tokyo.cjs +1 -0
- package/dist/timezones/Asia/Tokyo.js +1 -0
- package/dist/timezones/Asia/Tomsk.cjs +1 -0
- package/dist/timezones/Asia/Tomsk.js +1 -0
- package/dist/timezones/Asia/Ulaanbaatar.cjs +1 -0
- package/dist/timezones/Asia/Ulaanbaatar.js +1 -0
- package/dist/timezones/Asia/Urumqi.cjs +1 -0
- package/dist/timezones/Asia/Urumqi.js +1 -0
- package/dist/timezones/Asia/Ust-Nera.cjs +1 -0
- package/dist/timezones/Asia/Ust-Nera.js +1 -0
- package/dist/timezones/Asia/Vientiane.cjs +1 -0
- package/dist/timezones/Asia/Vientiane.js +1 -0
- package/dist/timezones/Asia/Vladivostok.cjs +1 -0
- package/dist/timezones/Asia/Vladivostok.js +1 -0
- package/dist/timezones/Asia/Yakutsk.cjs +1 -0
- package/dist/timezones/Asia/Yakutsk.js +1 -0
- package/dist/timezones/Asia/Yangon.cjs +1 -0
- package/dist/timezones/Asia/Yangon.js +1 -0
- package/dist/timezones/Asia/Yekaterinburg.cjs +1 -0
- package/dist/timezones/Asia/Yekaterinburg.js +1 -0
- package/dist/timezones/Asia/Yerevan.cjs +1 -0
- package/dist/timezones/Asia/Yerevan.js +1 -0
- package/dist/timezones/Atlantic/Azores.cjs +1 -0
- package/dist/timezones/Atlantic/Azores.js +1 -0
- package/dist/timezones/Atlantic/Bermuda.cjs +1 -0
- package/dist/timezones/Atlantic/Bermuda.js +1 -0
- package/dist/timezones/Atlantic/Canary.cjs +1 -0
- package/dist/timezones/Atlantic/Canary.js +1 -0
- package/dist/timezones/Atlantic/Cape_Verde.cjs +1 -0
- package/dist/timezones/Atlantic/Cape_Verde.js +1 -0
- package/dist/timezones/Atlantic/Faroe.cjs +1 -0
- package/dist/timezones/Atlantic/Faroe.js +1 -0
- package/dist/timezones/Atlantic/Madeira.cjs +1 -0
- package/dist/timezones/Atlantic/Madeira.js +1 -0
- package/dist/timezones/Atlantic/Reykjavik.cjs +1 -0
- package/dist/timezones/Atlantic/Reykjavik.js +1 -0
- package/dist/timezones/Atlantic/South_Georgia.cjs +1 -0
- package/dist/timezones/Atlantic/South_Georgia.js +1 -0
- package/dist/timezones/Atlantic/St_Helena.cjs +1 -0
- package/dist/timezones/Atlantic/St_Helena.js +1 -0
- package/dist/timezones/Atlantic/Stanley.cjs +1 -0
- package/dist/timezones/Atlantic/Stanley.js +1 -0
- package/dist/timezones/Australia/Adelaide.cjs +1 -0
- package/dist/timezones/Australia/Adelaide.js +1 -0
- package/dist/timezones/Australia/Brisbane.cjs +1 -0
- package/dist/timezones/Australia/Brisbane.js +1 -0
- package/dist/timezones/Australia/Broken_Hill.cjs +1 -0
- package/dist/timezones/Australia/Broken_Hill.js +1 -0
- package/dist/timezones/Australia/Darwin.cjs +1 -0
- package/dist/timezones/Australia/Darwin.js +1 -0
- package/dist/timezones/Australia/Eucla.cjs +1 -0
- package/dist/timezones/Australia/Eucla.js +1 -0
- package/dist/timezones/Australia/Hobart.cjs +1 -0
- package/dist/timezones/Australia/Hobart.js +1 -0
- package/dist/timezones/Australia/Lindeman.cjs +1 -0
- package/dist/timezones/Australia/Lindeman.js +1 -0
- package/dist/timezones/Australia/Lord_Howe.cjs +1 -0
- package/dist/timezones/Australia/Lord_Howe.js +1 -0
- package/dist/timezones/Australia/Melbourne.cjs +1 -0
- package/dist/timezones/Australia/Melbourne.js +1 -0
- package/dist/timezones/Australia/Perth.cjs +1 -0
- package/dist/timezones/Australia/Perth.js +1 -0
- package/dist/timezones/Australia/Sydney.cjs +1 -0
- package/dist/timezones/Australia/Sydney.js +1 -0
- package/dist/timezones/Europe/Amsterdam.cjs +1 -0
- package/dist/timezones/Europe/Amsterdam.js +1 -0
- package/dist/timezones/Europe/Andorra.cjs +1 -0
- package/dist/timezones/Europe/Andorra.js +1 -0
- package/dist/timezones/Europe/Astrakhan.cjs +1 -0
- package/dist/timezones/Europe/Astrakhan.js +1 -0
- package/dist/timezones/Europe/Athens.cjs +1 -0
- package/dist/timezones/Europe/Athens.js +1 -0
- package/dist/timezones/Europe/Belgrade.cjs +1 -0
- package/dist/timezones/Europe/Belgrade.js +1 -0
- package/dist/timezones/Europe/Berlin.cjs +1 -0
- package/dist/timezones/Europe/Berlin.js +1 -0
- package/dist/timezones/Europe/Bratislava.cjs +1 -0
- package/dist/timezones/Europe/Bratislava.js +1 -0
- package/dist/timezones/Europe/Brussels.cjs +1 -0
- package/dist/timezones/Europe/Brussels.js +1 -0
- package/dist/timezones/Europe/Bucharest.cjs +1 -0
- package/dist/timezones/Europe/Bucharest.js +1 -0
- package/dist/timezones/Europe/Budapest.cjs +1 -0
- package/dist/timezones/Europe/Budapest.js +1 -0
- package/dist/timezones/Europe/Busingen.cjs +1 -0
- package/dist/timezones/Europe/Busingen.js +1 -0
- package/dist/timezones/Europe/Chisinau.cjs +1 -0
- package/dist/timezones/Europe/Chisinau.js +1 -0
- package/dist/timezones/Europe/Copenhagen.cjs +1 -0
- package/dist/timezones/Europe/Copenhagen.js +1 -0
- package/dist/timezones/Europe/Dublin.cjs +1 -0
- package/dist/timezones/Europe/Dublin.js +1 -0
- package/dist/timezones/Europe/Gibraltar.cjs +1 -0
- package/dist/timezones/Europe/Gibraltar.js +1 -0
- package/dist/timezones/Europe/Guernsey.cjs +1 -0
- package/dist/timezones/Europe/Guernsey.js +1 -0
- package/dist/timezones/Europe/Helsinki.cjs +1 -0
- package/dist/timezones/Europe/Helsinki.js +1 -0
- package/dist/timezones/Europe/Isle_of_Man.cjs +1 -0
- package/dist/timezones/Europe/Isle_of_Man.js +1 -0
- package/dist/timezones/Europe/Istanbul.cjs +1 -0
- package/dist/timezones/Europe/Istanbul.js +1 -0
- package/dist/timezones/Europe/Jersey.cjs +1 -0
- package/dist/timezones/Europe/Jersey.js +1 -0
- package/dist/timezones/Europe/Kaliningrad.cjs +1 -0
- package/dist/timezones/Europe/Kaliningrad.js +1 -0
- package/dist/timezones/Europe/Kirov.cjs +1 -0
- package/dist/timezones/Europe/Kirov.js +1 -0
- package/dist/timezones/Europe/Kyiv.cjs +1 -0
- package/dist/timezones/Europe/Kyiv.js +1 -0
- package/dist/timezones/Europe/Lisbon.cjs +1 -0
- package/dist/timezones/Europe/Lisbon.js +1 -0
- package/dist/timezones/Europe/Ljubljana.cjs +1 -0
- package/dist/timezones/Europe/Ljubljana.js +1 -0
- package/dist/timezones/Europe/London.cjs +1 -0
- package/dist/timezones/Europe/London.js +1 -0
- package/dist/timezones/Europe/Luxembourg.cjs +1 -0
- package/dist/timezones/Europe/Luxembourg.js +1 -0
- package/dist/timezones/Europe/Madrid.cjs +1 -0
- package/dist/timezones/Europe/Madrid.js +1 -0
- package/dist/timezones/Europe/Malta.cjs +1 -0
- package/dist/timezones/Europe/Malta.js +1 -0
- package/dist/timezones/Europe/Mariehamn.cjs +1 -0
- package/dist/timezones/Europe/Mariehamn.js +1 -0
- package/dist/timezones/Europe/Minsk.cjs +1 -0
- package/dist/timezones/Europe/Minsk.js +1 -0
- package/dist/timezones/Europe/Monaco.cjs +1 -0
- package/dist/timezones/Europe/Monaco.js +1 -0
- package/dist/timezones/Europe/Moscow.cjs +1 -0
- package/dist/timezones/Europe/Moscow.js +1 -0
- package/dist/timezones/Europe/Oslo.cjs +1 -0
- package/dist/timezones/Europe/Oslo.js +1 -0
- package/dist/timezones/Europe/Paris.cjs +1 -0
- package/dist/timezones/Europe/Paris.js +1 -0
- package/dist/timezones/Europe/Podgorica.cjs +1 -0
- package/dist/timezones/Europe/Podgorica.js +1 -0
- package/dist/timezones/Europe/Prague.cjs +1 -0
- package/dist/timezones/Europe/Prague.js +1 -0
- package/dist/timezones/Europe/Riga.cjs +1 -0
- package/dist/timezones/Europe/Riga.js +1 -0
- package/dist/timezones/Europe/Rome.cjs +1 -0
- package/dist/timezones/Europe/Rome.js +1 -0
- package/dist/timezones/Europe/Samara.cjs +1 -0
- package/dist/timezones/Europe/Samara.js +1 -0
- package/dist/timezones/Europe/San_Marino.cjs +1 -0
- package/dist/timezones/Europe/San_Marino.js +1 -0
- package/dist/timezones/Europe/Sarajevo.cjs +1 -0
- package/dist/timezones/Europe/Sarajevo.js +1 -0
- package/dist/timezones/Europe/Saratov.cjs +1 -0
- package/dist/timezones/Europe/Saratov.js +1 -0
- package/dist/timezones/Europe/Simferopol.cjs +1 -0
- package/dist/timezones/Europe/Simferopol.js +1 -0
- package/dist/timezones/Europe/Skopje.cjs +1 -0
- package/dist/timezones/Europe/Skopje.js +1 -0
- package/dist/timezones/Europe/Sofia.cjs +1 -0
- package/dist/timezones/Europe/Sofia.js +1 -0
- package/dist/timezones/Europe/Stockholm.cjs +1 -0
- package/dist/timezones/Europe/Stockholm.js +1 -0
- package/dist/timezones/Europe/Tallinn.cjs +1 -0
- package/dist/timezones/Europe/Tallinn.js +1 -0
- package/dist/timezones/Europe/Tirane.cjs +1 -0
- package/dist/timezones/Europe/Tirane.js +1 -0
- package/dist/timezones/Europe/Ulyanovsk.cjs +1 -0
- package/dist/timezones/Europe/Ulyanovsk.js +1 -0
- package/dist/timezones/Europe/Vaduz.cjs +1 -0
- package/dist/timezones/Europe/Vaduz.js +1 -0
- package/dist/timezones/Europe/Vatican.cjs +1 -0
- package/dist/timezones/Europe/Vatican.js +1 -0
- package/dist/timezones/Europe/Vienna.cjs +1 -0
- package/dist/timezones/Europe/Vienna.js +1 -0
- package/dist/timezones/Europe/Vilnius.cjs +1 -0
- package/dist/timezones/Europe/Vilnius.js +1 -0
- package/dist/timezones/Europe/Volgograd.cjs +1 -0
- package/dist/timezones/Europe/Volgograd.js +1 -0
- package/dist/timezones/Europe/Warsaw.cjs +1 -0
- package/dist/timezones/Europe/Warsaw.js +1 -0
- package/dist/timezones/Europe/Zagreb.cjs +1 -0
- package/dist/timezones/Europe/Zagreb.js +1 -0
- package/dist/timezones/Europe/Zurich.cjs +1 -0
- package/dist/timezones/Europe/Zurich.js +1 -0
- package/dist/timezones/Indian/Antananarivo.cjs +1 -0
- package/dist/timezones/Indian/Antananarivo.js +1 -0
- package/dist/timezones/Indian/Chagos.cjs +1 -0
- package/dist/timezones/Indian/Chagos.js +1 -0
- package/dist/timezones/Indian/Christmas.cjs +1 -0
- package/dist/timezones/Indian/Christmas.js +1 -0
- package/dist/timezones/Indian/Cocos.cjs +1 -0
- package/dist/timezones/Indian/Cocos.js +1 -0
- package/dist/timezones/Indian/Comoro.cjs +1 -0
- package/dist/timezones/Indian/Comoro.js +1 -0
- package/dist/timezones/Indian/Kerguelen.cjs +1 -0
- package/dist/timezones/Indian/Kerguelen.js +1 -0
- package/dist/timezones/Indian/Mahe.cjs +1 -0
- package/dist/timezones/Indian/Mahe.js +1 -0
- package/dist/timezones/Indian/Maldives.cjs +1 -0
- package/dist/timezones/Indian/Maldives.js +1 -0
- package/dist/timezones/Indian/Mauritius.cjs +1 -0
- package/dist/timezones/Indian/Mauritius.js +1 -0
- package/dist/timezones/Indian/Mayotte.cjs +1 -0
- package/dist/timezones/Indian/Mayotte.js +1 -0
- package/dist/timezones/Indian/Reunion.cjs +1 -0
- package/dist/timezones/Indian/Reunion.js +1 -0
- package/dist/timezones/Pacific/Apia.cjs +1 -0
- package/dist/timezones/Pacific/Apia.js +1 -0
- package/dist/timezones/Pacific/Auckland.cjs +1 -0
- package/dist/timezones/Pacific/Auckland.js +1 -0
- package/dist/timezones/Pacific/Bougainville.cjs +1 -0
- package/dist/timezones/Pacific/Bougainville.js +1 -0
- package/dist/timezones/Pacific/Chatham.cjs +1 -0
- package/dist/timezones/Pacific/Chatham.js +1 -0
- package/dist/timezones/Pacific/Chuuk.cjs +1 -0
- package/dist/timezones/Pacific/Chuuk.js +1 -0
- package/dist/timezones/Pacific/Easter.cjs +1 -0
- package/dist/timezones/Pacific/Easter.js +1 -0
- package/dist/timezones/Pacific/Efate.cjs +1 -0
- package/dist/timezones/Pacific/Efate.js +1 -0
- package/dist/timezones/Pacific/Fakaofo.cjs +1 -0
- package/dist/timezones/Pacific/Fakaofo.js +1 -0
- package/dist/timezones/Pacific/Fiji.cjs +1 -0
- package/dist/timezones/Pacific/Fiji.js +1 -0
- package/dist/timezones/Pacific/Funafuti.cjs +1 -0
- package/dist/timezones/Pacific/Funafuti.js +1 -0
- package/dist/timezones/Pacific/Galapagos.cjs +1 -0
- package/dist/timezones/Pacific/Galapagos.js +1 -0
- package/dist/timezones/Pacific/Gambier.cjs +1 -0
- package/dist/timezones/Pacific/Gambier.js +1 -0
- package/dist/timezones/Pacific/Guadalcanal.cjs +1 -0
- package/dist/timezones/Pacific/Guadalcanal.js +1 -0
- package/dist/timezones/Pacific/Guam.cjs +1 -0
- package/dist/timezones/Pacific/Guam.js +1 -0
- package/dist/timezones/Pacific/Honolulu.cjs +1 -0
- package/dist/timezones/Pacific/Honolulu.js +1 -0
- package/dist/timezones/Pacific/Kanton.cjs +1 -0
- package/dist/timezones/Pacific/Kanton.js +1 -0
- package/dist/timezones/Pacific/Kiritimati.cjs +1 -0
- package/dist/timezones/Pacific/Kiritimati.js +1 -0
- package/dist/timezones/Pacific/Kosrae.cjs +1 -0
- package/dist/timezones/Pacific/Kosrae.js +1 -0
- package/dist/timezones/Pacific/Kwajalein.cjs +1 -0
- package/dist/timezones/Pacific/Kwajalein.js +1 -0
- package/dist/timezones/Pacific/Majuro.cjs +1 -0
- package/dist/timezones/Pacific/Majuro.js +1 -0
- package/dist/timezones/Pacific/Marquesas.cjs +1 -0
- package/dist/timezones/Pacific/Marquesas.js +1 -0
- package/dist/timezones/Pacific/Midway.cjs +1 -0
- package/dist/timezones/Pacific/Midway.js +1 -0
- package/dist/timezones/Pacific/Nauru.cjs +1 -0
- package/dist/timezones/Pacific/Nauru.js +1 -0
- package/dist/timezones/Pacific/Niue.cjs +1 -0
- package/dist/timezones/Pacific/Niue.js +1 -0
- package/dist/timezones/Pacific/Norfolk.cjs +1 -0
- package/dist/timezones/Pacific/Norfolk.js +1 -0
- package/dist/timezones/Pacific/Noumea.cjs +1 -0
- package/dist/timezones/Pacific/Noumea.js +1 -0
- package/dist/timezones/Pacific/Pago_Pago.cjs +1 -0
- package/dist/timezones/Pacific/Pago_Pago.js +1 -0
- package/dist/timezones/Pacific/Palau.cjs +1 -0
- package/dist/timezones/Pacific/Palau.js +1 -0
- package/dist/timezones/Pacific/Pitcairn.cjs +1 -0
- package/dist/timezones/Pacific/Pitcairn.js +1 -0
- package/dist/timezones/Pacific/Pohnpei.cjs +1 -0
- package/dist/timezones/Pacific/Pohnpei.js +1 -0
- package/dist/timezones/Pacific/Port_Moresby.cjs +1 -0
- package/dist/timezones/Pacific/Port_Moresby.js +1 -0
- package/dist/timezones/Pacific/Rarotonga.cjs +1 -0
- package/dist/timezones/Pacific/Rarotonga.js +1 -0
- package/dist/timezones/Pacific/Saipan.cjs +1 -0
- package/dist/timezones/Pacific/Saipan.js +1 -0
- package/dist/timezones/Pacific/Tahiti.cjs +1 -0
- package/dist/timezones/Pacific/Tahiti.js +1 -0
- package/dist/timezones/Pacific/Tarawa.cjs +1 -0
- package/dist/timezones/Pacific/Tarawa.js +1 -0
- package/dist/timezones/Pacific/Tongatapu.cjs +1 -0
- package/dist/timezones/Pacific/Tongatapu.js +1 -0
- package/dist/timezones/Pacific/Wake.cjs +1 -0
- package/dist/timezones/Pacific/Wake.js +1 -0
- package/dist/timezones/Pacific/Wallis.cjs +1 -0
- package/dist/timezones/Pacific/Wallis.js +1 -0
- package/docs/MIGRATION.md +226 -0
- package/docs/PLUGINS.md +206 -0
- package/package.json +57 -41
- package/EXTEND.md +0 -107
- package/LOCALE.md +0 -103
- package/PLUGINS.md +0 -486
- package/date-and-time.d.ts +0 -343
- package/date-and-time.js +0 -520
- package/date-and-time.min.js +0 -4
- package/esm/date-and-time.es.js +0 -512
- package/esm/date-and-time.es.min.js +0 -4
- package/esm/date-and-time.mjs +0 -512
- package/esm/locale/ar.es.js +0 -39
- package/esm/locale/ar.mjs +0 -39
- package/esm/locale/az.es.js +0 -44
- package/esm/locale/az.mjs +0 -44
- package/esm/locale/bn.es.js +0 -50
- package/esm/locale/bn.mjs +0 -50
- package/esm/locale/cs.es.js +0 -22
- package/esm/locale/cs.mjs +0 -22
- package/esm/locale/de.es.js +0 -23
- package/esm/locale/de.mjs +0 -23
- package/esm/locale/dk.es.js +0 -22
- package/esm/locale/dk.mjs +0 -22
- package/esm/locale/el.es.js +0 -44
- package/esm/locale/el.mjs +0 -44
- package/esm/locale/en.es.js +0 -13
- package/esm/locale/en.mjs +0 -13
- package/esm/locale/es.es.js +0 -42
- package/esm/locale/es.mjs +0 -42
- package/esm/locale/fa.es.js +0 -39
- package/esm/locale/fa.mjs +0 -39
- package/esm/locale/fr.es.js +0 -23
- package/esm/locale/fr.mjs +0 -23
- package/esm/locale/hi.es.js +0 -50
- package/esm/locale/hi.mjs +0 -50
- package/esm/locale/hu.es.js +0 -23
- package/esm/locale/hu.mjs +0 -23
- package/esm/locale/id.es.js +0 -46
- package/esm/locale/id.mjs +0 -46
- package/esm/locale/it.es.js +0 -23
- package/esm/locale/it.mjs +0 -23
- package/esm/locale/ja.es.js +0 -31
- package/esm/locale/ja.mjs +0 -31
- package/esm/locale/jv.es.js +0 -46
- package/esm/locale/jv.mjs +0 -46
- package/esm/locale/ko.es.js +0 -23
- package/esm/locale/ko.mjs +0 -23
- package/esm/locale/my.es.js +0 -38
- package/esm/locale/my.mjs +0 -38
- package/esm/locale/nl.es.js +0 -37
- package/esm/locale/nl.mjs +0 -37
- package/esm/locale/pa-in.es.js +0 -62
- package/esm/locale/pa-in.mjs +0 -62
- package/esm/locale/pl.es.js +0 -37
- package/esm/locale/pl.mjs +0 -37
- package/esm/locale/pt.es.js +0 -44
- package/esm/locale/pt.mjs +0 -44
- package/esm/locale/ro.es.js +0 -22
- package/esm/locale/ro.mjs +0 -22
- package/esm/locale/ru.es.js +0 -44
- package/esm/locale/ru.mjs +0 -44
- package/esm/locale/rw.es.js +0 -22
- package/esm/locale/rw.mjs +0 -22
- package/esm/locale/sr.es.js +0 -22
- package/esm/locale/sr.mjs +0 -22
- package/esm/locale/sv.es.js +0 -22
- package/esm/locale/sv.mjs +0 -22
- package/esm/locale/th.es.js +0 -23
- package/esm/locale/th.mjs +0 -23
- package/esm/locale/tr.es.js +0 -22
- package/esm/locale/tr.mjs +0 -22
- package/esm/locale/uk.es.js +0 -57
- package/esm/locale/uk.mjs +0 -57
- package/esm/locale/uz.es.js +0 -22
- package/esm/locale/uz.mjs +0 -22
- package/esm/locale/vi.es.js +0 -23
- package/esm/locale/vi.mjs +0 -23
- package/esm/locale/zh-cn.es.js +0 -48
- package/esm/locale/zh-cn.mjs +0 -48
- package/esm/locale/zh-tw.es.js +0 -46
- package/esm/locale/zh-tw.mjs +0 -46
- package/esm/plugin/day-of-week.es.js +0 -19
- package/esm/plugin/day-of-week.mjs +0 -19
- package/esm/plugin/meridiem.es.js +0 -47
- package/esm/plugin/meridiem.mjs +0 -47
- package/esm/plugin/microsecond.es.js +0 -31
- package/esm/plugin/microsecond.mjs +0 -31
- package/esm/plugin/ordinal.es.js +0 -34
- package/esm/plugin/ordinal.mjs +0 -34
- package/esm/plugin/timespan.es.js +0 -75
- package/esm/plugin/timespan.mjs +0 -75
- package/esm/plugin/timezone.es.js +0 -725
- package/esm/plugin/timezone.mjs +0 -725
- package/esm/plugin/two-digit-year.es.js +0 -21
- package/esm/plugin/two-digit-year.mjs +0 -21
- package/locale/ar.d.ts +0 -1
- package/locale/ar.js +0 -47
- package/locale/az.d.ts +0 -1
- package/locale/az.js +0 -52
- package/locale/bn.d.ts +0 -1
- package/locale/bn.js +0 -58
- package/locale/cs.d.ts +0 -1
- package/locale/cs.js +0 -30
- package/locale/de.d.ts +0 -1
- package/locale/de.js +0 -31
- package/locale/dk.d.ts +0 -1
- package/locale/dk.js +0 -30
- package/locale/el.d.ts +0 -1
- package/locale/el.js +0 -52
- package/locale/en.d.ts +0 -1
- package/locale/en.js +0 -21
- package/locale/es.d.ts +0 -1
- package/locale/es.js +0 -50
- package/locale/fa.d.ts +0 -1
- package/locale/fa.js +0 -47
- package/locale/fr.d.ts +0 -1
- package/locale/fr.js +0 -31
- package/locale/hi.d.ts +0 -1
- package/locale/hi.js +0 -58
- package/locale/hu.d.ts +0 -1
- package/locale/hu.js +0 -31
- package/locale/id.d.ts +0 -1
- package/locale/id.js +0 -54
- package/locale/it.d.ts +0 -1
- package/locale/it.js +0 -31
- package/locale/ja.d.ts +0 -1
- package/locale/ja.js +0 -39
- package/locale/jv.d.ts +0 -1
- package/locale/jv.js +0 -54
- package/locale/ko.d.ts +0 -1
- package/locale/ko.js +0 -31
- package/locale/my.d.ts +0 -1
- package/locale/my.js +0 -46
- package/locale/nl.d.ts +0 -1
- package/locale/nl.js +0 -45
- package/locale/pa-in.d.ts +0 -1
- package/locale/pa-in.js +0 -70
- package/locale/pl.d.ts +0 -1
- package/locale/pl.js +0 -45
- package/locale/pt.d.ts +0 -1
- package/locale/pt.js +0 -52
- package/locale/ro.d.ts +0 -1
- package/locale/ro.js +0 -30
- package/locale/ru.d.ts +0 -1
- package/locale/ru.js +0 -52
- package/locale/rw.d.ts +0 -1
- package/locale/rw.js +0 -30
- package/locale/sr.d.ts +0 -1
- package/locale/sr.js +0 -30
- package/locale/sv.d.ts +0 -1
- package/locale/sv.js +0 -30
- package/locale/th.d.ts +0 -1
- package/locale/th.js +0 -31
- package/locale/tr.d.ts +0 -1
- package/locale/tr.js +0 -30
- package/locale/uk.d.ts +0 -1
- package/locale/uk.js +0 -65
- package/locale/uz.d.ts +0 -1
- package/locale/uz.js +0 -30
- package/locale/vi.d.ts +0 -1
- package/locale/vi.js +0 -31
- package/locale/zh-cn.d.ts +0 -1
- package/locale/zh-cn.js +0 -56
- package/locale/zh-tw.d.ts +0 -1
- package/locale/zh-tw.js +0 -54
- package/plugin/day-of-week.d.ts +0 -1
- package/plugin/day-of-week.js +0 -27
- package/plugin/meridiem.d.ts +0 -1
- package/plugin/meridiem.js +0 -55
- package/plugin/microsecond.d.ts +0 -1
- package/plugin/microsecond.js +0 -39
- package/plugin/ordinal.d.ts +0 -1
- package/plugin/ordinal.js +0 -42
- package/plugin/timespan.d.ts +0 -24
- package/plugin/timespan.js +0 -83
- package/plugin/timezone.d.ts +0 -106
- package/plugin/timezone.js +0 -733
- package/plugin/two-digit-year.d.ts +0 -1
- package/plugin/two-digit-year.js +0 -29
package/README.md
CHANGED
|
@@ -1,630 +1,1315 @@
|
|
|
1
1
|
# date-and-time
|
|
2
2
|
|
|
3
|
-
[](https://github.com/knowledgecode/date-and-time/actions/workflows/test.yml)
|
|
4
|
+
[](https://github.com/knowledgecode/date-and-time/actions/workflows/test.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/date-and-time)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
The simplest and most user-friendly date and time manipulation library
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## Install
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
```shell
|
|
12
|
+
npm i date-and-time
|
|
13
|
+
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
- ESModules:
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- Multi language support.
|
|
16
|
-
- Universal / Isomorphic. Works anywhere.
|
|
17
|
-
- TypeScript support.
|
|
18
|
-
- Older browser support. Even works on IE6. :)
|
|
17
|
+
```typescript
|
|
18
|
+
import { format } from 'date-and-time';
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
format(new Date(), 'ddd, MMM DD YYYY');
|
|
21
|
+
// => Wed, Jul 09 2025
|
|
22
|
+
```
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
- CommonJS:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
const { format } = require('date-and-time');
|
|
28
|
+
|
|
29
|
+
format(new Date(), 'ddd, MMM DD YYYY');
|
|
30
|
+
// => Wed, Jul 09 2025
|
|
24
31
|
```
|
|
25
32
|
|
|
26
|
-
##
|
|
33
|
+
## Migration
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
- Added `addYearsTZ()`, `addMonthsTZ()`, and `addDaysTZ()` to the `timezone` plugin.
|
|
30
|
-
- Revised the approach to adding time and removed the third parameter from `addHours()`, `addMinutes()`, `addSeconds()`, and `addMilliseconds()`.
|
|
35
|
+
Version `4.x` has been completely rewritten in TypeScript and some features from `3.x` are no longer compatible. The main changes are as follows:
|
|
31
36
|
|
|
32
|
-
-
|
|
33
|
-
|
|
37
|
+
- The `timezone` and `timespan` plugins have been integrated into the main library
|
|
38
|
+
- Tree shaking is now supported
|
|
39
|
+
- Supports `ES2021` and no longer supports older browsers
|
|
40
|
+
|
|
41
|
+
For details, please refer to [MIGRATION.md](docs/MIGRATION.md).
|
|
42
|
+
|
|
43
|
+
## API
|
|
34
44
|
|
|
35
|
-
|
|
36
|
-
- Added `zz` (time zone name) and `z` (time zone name abbreviation) tokens to the `timezone` plugin.
|
|
37
|
-
- Fixed an issue where token extensions by other plugins were not reflected in functions provided by the `timezone` plugin.
|
|
45
|
+
## format(dateObj, arg[, options])
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
<details>
|
|
48
|
+
<summary>Formats a Date object according to the specified format string.</summary>
|
|
40
49
|
|
|
41
|
-
-
|
|
50
|
+
- dateObj
|
|
51
|
+
- type: `Date`
|
|
52
|
+
- The Date object to format
|
|
53
|
+
- arg
|
|
54
|
+
- type: `string | CompiledObject`
|
|
55
|
+
- The format string or compiled object to match against the Date object
|
|
56
|
+
- [options]
|
|
57
|
+
- type: `FormatterOptions`
|
|
58
|
+
- Optional formatter options for customization
|
|
42
59
|
|
|
43
|
-
```
|
|
44
|
-
import
|
|
60
|
+
```typescript
|
|
61
|
+
import { format } from 'date-and-time';
|
|
62
|
+
import Tokyo from 'date-and-time/timezones/Asia/Tokyo';
|
|
63
|
+
import ja from 'date-and-time/locales/ja';
|
|
64
|
+
|
|
65
|
+
const now = new Date();
|
|
66
|
+
|
|
67
|
+
format(now, 'YYYY/MM/DD HH:mm:ss');
|
|
68
|
+
// => 2015/01/01 23:14:05
|
|
69
|
+
|
|
70
|
+
format(now, 'ddd, MMM DD YYYY');
|
|
71
|
+
// => Thu, Jan 01 2015
|
|
72
|
+
|
|
73
|
+
format(now, 'ddd, MMM DD YYYY hh:mm A [GMT]Z', { timeZone: 'UTC' });
|
|
74
|
+
// => Fri, Jan 02 2015 07:14 AM GMT+0000
|
|
75
|
+
|
|
76
|
+
format(now, 'YYYY年MMMM月D日dddd Ah:mm:ss [GMT]Z', { timeZone: Tokyo, locale: ja });
|
|
77
|
+
// => 2015年1月2日金曜日 午後4:14:05 GMT+0900
|
|
45
78
|
```
|
|
46
79
|
|
|
47
|
-
|
|
80
|
+
The tokens available for use in the format string specified as the second argument and their meanings are as follows:
|
|
81
|
+
|
|
82
|
+
| Token | Meaning | Output Examples |
|
|
83
|
+
|:---------|:--------------------------------------------|:----------------------|
|
|
84
|
+
| YYYY | 4-digit year | 0999, 2015 |
|
|
85
|
+
| YY | 2-digit year | 99, 01, 15 |
|
|
86
|
+
| Y | Year without zero padding | 2, 44, 888, 2015 |
|
|
87
|
+
| MMMM | Full month name | January, December |
|
|
88
|
+
| MMM | Short month name | Jan, Dec |
|
|
89
|
+
| MM | Month | 01, 12 |
|
|
90
|
+
| M | Month without zero padding | 1, 12 |
|
|
91
|
+
| DD | Day | 02, 31 |
|
|
92
|
+
| D | Day without zero padding | 2, 31 |
|
|
93
|
+
| dddd | Full day name | Friday, Sunday |
|
|
94
|
+
| ddd | Short day name | Fri, Sun |
|
|
95
|
+
| dd | Very short day name | Fr, Su |
|
|
96
|
+
| HH | Hour in 24-hour format | 23, 08 |
|
|
97
|
+
| H | Hour in 24-hour format without zero padding | 23, 8 |
|
|
98
|
+
| hh | Hour in 12-hour format | 11, 08 |
|
|
99
|
+
| h | Hour in 12-hour format without zero padding | 11, 8 |
|
|
100
|
+
| A | Uppercase AM/PM | AM, PM |
|
|
101
|
+
| AA | Uppercase AM/PM (with periods) | A.M., P.M. |
|
|
102
|
+
| a | Lowercase AM/PM | am, pm |
|
|
103
|
+
| aa | Lowercase AM/PM (with periods) | a.m., p.m. |
|
|
104
|
+
| mm | Minutes | 14, 07 |
|
|
105
|
+
| m | Minutes without zero padding | 14, 7 |
|
|
106
|
+
| ss | Seconds | 05, 10 |
|
|
107
|
+
| s | Seconds without zero padding | 5, 10 |
|
|
108
|
+
| SSS | 3-digit milliseconds | 753, 022 |
|
|
109
|
+
| SS | 2-digit milliseconds | 75, 02 |
|
|
110
|
+
| S | 1-digit milliseconds | 7, 0 |
|
|
111
|
+
| Z | Timezone offset | +0100, -0800 |
|
|
112
|
+
| ZZ | Timezone offset with colon | +01:00, -08:00 |
|
|
113
|
+
|
|
114
|
+
Additionally, by importing plugins, you can use the following tokens. For details, please refer to [PLUGINS.md](docs/PLUGINS.md).
|
|
115
|
+
|
|
116
|
+
| Token | Meaning | Output Examples |
|
|
117
|
+
|:---------|:--------------------------------------------|:----------------------|
|
|
118
|
+
| DDD | Ordinal representation of day | 1st, 2nd, 3rd |
|
|
119
|
+
| z | Short timezone name | PST, EST |
|
|
120
|
+
| zz | Long timezone name | Pacific Standard Time |
|
|
121
|
+
|
|
122
|
+
The breakdown of `FormatterOptions` that can be specified as the third argument is as follows:
|
|
123
|
+
|
|
124
|
+
<details>
|
|
125
|
+
<summary><strong>hour12</strong></summary>
|
|
126
|
+
|
|
127
|
+
- type: `h11 | h12`
|
|
128
|
+
- default: `h12`
|
|
129
|
+
- The hour format to use for formatting. This is used when the hour is in 12-hour format. It can be `h11` for 11-hour format or `h12` for 12-hour format.
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
format(now, 'dddd, MMMM D, YYYY [at] h:mm:ss.SSS A [GMT]ZZ', { hour12: 'h11' });
|
|
133
|
+
// Wednesday, July 23, 2025 at 0:12:54.814 AM GMT-07:00
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
</details>
|
|
137
|
+
|
|
138
|
+
<details>
|
|
139
|
+
<summary><strong>hour24</strong></summary>
|
|
140
|
+
|
|
141
|
+
- type: `h23 | h24`
|
|
142
|
+
- default: `h23`
|
|
143
|
+
- The hour format to use for formatting. This is used when the hour is in 24-hour format. It can be `h23` for 23-hour format or `h24` for 24-hour format.
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
format(now, 'dddd, MMMM D, YYYY [at] H:mm:ss.SSS [GMT]ZZ', { hour24: 'h24' });
|
|
147
|
+
// => Wednesday, July 23, 2025 at 24:12:54.814 GMT-07:00
|
|
148
|
+
```
|
|
48
149
|
|
|
49
|
-
|
|
50
|
-
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
<details>
|
|
153
|
+
<summary><strong>numeral</strong></summary>
|
|
154
|
+
|
|
155
|
+
- type: `Numeral`
|
|
156
|
+
- default: `latn`
|
|
157
|
+
- The numeral system to use for formatting numbers. This is an object that provides methods to encode and decode numbers in the specified numeral system.
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import arab from 'date-and-time/numerals/arab';
|
|
161
|
+
|
|
162
|
+
format(now, 'DD/MM/YYYY', { numeral: arab });
|
|
163
|
+
// => ٠٨/٠٧/٢٠٢٥
|
|
51
164
|
```
|
|
52
165
|
|
|
53
|
-
|
|
166
|
+
Currently, the following numeral systems are supported:
|
|
167
|
+
|
|
168
|
+
- `arab`
|
|
169
|
+
- `arabext`
|
|
170
|
+
- `beng`
|
|
171
|
+
- `latn`
|
|
172
|
+
- `mymr`
|
|
173
|
+
|
|
174
|
+
</details>
|
|
175
|
+
|
|
176
|
+
<details>
|
|
177
|
+
<summary><strong>calendar</strong></summary>
|
|
54
178
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
179
|
+
- type: `buddhist | gregory`
|
|
180
|
+
- default: `gregory`
|
|
181
|
+
- The calendar system to use for formatting dates. This can be `buddhist` for Buddhist calendar or `gregory` for Gregorian calendar.
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
format(now, 'dddd, MMMM D, YYYY', { calendar: 'buddhist' });
|
|
185
|
+
// => Wednesday, July 23, 2568
|
|
59
186
|
```
|
|
60
187
|
|
|
61
|
-
|
|
188
|
+
</details>
|
|
189
|
+
|
|
190
|
+
<details>
|
|
191
|
+
<summary><strong>timeZone</strong></summary>
|
|
192
|
+
|
|
193
|
+
- type: `TimeZone | UTC`
|
|
194
|
+
- default: `undefined`
|
|
195
|
+
- The time zone to use for formatting dates and times. This can be a specific time zone object or `UTC` to use Coordinated Universal Time. If not specified, it defaults to undefined, which means the local time zone will be used.
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
import New_York from 'date-and-time/timezones/America/New_York';
|
|
62
199
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// You will be able to access the global variable `date`.
|
|
66
|
-
</script>
|
|
200
|
+
format(now, 'dddd, MMMM D, YYYY [at] H:mm:ss.SSS [GMT]ZZ', { timeZone: New_York });
|
|
201
|
+
// => Wednesday, July 23, 2025 at 3:28:27.443 GMT-04:00
|
|
67
202
|
```
|
|
68
203
|
|
|
69
|
-
|
|
204
|
+
</details>
|
|
70
205
|
|
|
71
|
-
|
|
206
|
+
<details>
|
|
207
|
+
<summary><strong>locale</strong></summary>
|
|
72
208
|
|
|
73
|
-
|
|
209
|
+
- type: `Locale`
|
|
210
|
+
- default: `en`
|
|
211
|
+
- The locale to use for formatting dates and times. This is an object that provides methods to get localized month names, day names, and meridiems.
|
|
74
212
|
|
|
75
|
-
|
|
76
|
-
|
|
213
|
+
```typescript
|
|
214
|
+
import es from 'date-and-time/locales/es';
|
|
77
215
|
|
|
78
|
-
|
|
79
|
-
|
|
216
|
+
format(now, 'dddd, D [de] MMMM [de] YYYY, h:mm:ss.SSS aa [GMT]ZZ', { locale: es });
|
|
217
|
+
// => miércoles, 23 de julio de 2025, 12:38:08,533 a.m. GMT-07:00
|
|
218
|
+
```
|
|
80
219
|
|
|
81
|
-
|
|
82
|
-
|
|
220
|
+
<details>
|
|
221
|
+
<summary>Currently, the following locales are supported:</summary>
|
|
222
|
+
|
|
223
|
+
- `ar` (Arabic)
|
|
224
|
+
- `az` (Azerbaijani)
|
|
225
|
+
- `bn` (Bengali)
|
|
226
|
+
- `cs` (Czech)
|
|
227
|
+
- `da` (Danish)
|
|
228
|
+
- `de` (German)
|
|
229
|
+
- `el` (Greek)
|
|
230
|
+
- `en` (English)
|
|
231
|
+
- `es` (Spanish)
|
|
232
|
+
- `fa` (Persian)
|
|
233
|
+
- `fi` (Finnish)
|
|
234
|
+
- `fr` (French)
|
|
235
|
+
- `he` (Hebrew)
|
|
236
|
+
- `hi` (Hindi)
|
|
237
|
+
- `hu` (Hungarian)
|
|
238
|
+
- `id` (Indonesian)
|
|
239
|
+
- `it` (Italian)
|
|
240
|
+
- `ja` (Japanese)
|
|
241
|
+
- `ko` (Korean)
|
|
242
|
+
- `ms` (Malay)
|
|
243
|
+
- `my` (Burmese)
|
|
244
|
+
- `nl` (Dutch)
|
|
245
|
+
- `no` (Norwegian)
|
|
246
|
+
- `pl` (Polish)
|
|
247
|
+
- `pt-BR` (Brazilian Portuguese)
|
|
248
|
+
- `pt-PT` (European Portuguese)
|
|
249
|
+
- `ro` (Romanian)
|
|
250
|
+
- `ru` (Russian)
|
|
251
|
+
- `rw` (Kinyarwanda)
|
|
252
|
+
- `sr-Cyrl` (Serbian Cyrillic)
|
|
253
|
+
- `sr-Latn` (Serbian Latin)
|
|
254
|
+
- `sv` (Swedish)
|
|
255
|
+
- `ta` (Tamil)
|
|
256
|
+
- `th` (Thai)
|
|
257
|
+
- `tr` (Turkish)
|
|
258
|
+
- `uk` (Ukrainian)
|
|
259
|
+
- `uz-Cyrl` (Uzbek Cyrillic)
|
|
260
|
+
- `uz-Latn` (Uzbek Latin)
|
|
261
|
+
- `vi` (Vietnamese)
|
|
262
|
+
- `zh-Hans` (Simplified Chinese)
|
|
263
|
+
- `zh-Hant` (Traditional Chinese)
|
|
264
|
+
|
|
265
|
+
</details>
|
|
266
|
+
</details>
|
|
267
|
+
|
|
268
|
+
### Notes
|
|
269
|
+
|
|
270
|
+
<details>
|
|
271
|
+
<summary><strong>Comments</strong></summary>
|
|
272
|
+
|
|
273
|
+
Parts of the format string enclosed in brackets are output as-is, regardless of whether they are valid tokens.
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
format(new Date(), 'DD-[MM]-YYYY'); // => '02-MM-2015'
|
|
277
|
+
format(new Date(), '[DD-[MM]-YYYY]'); // => 'DD-[MM]-YYYY'
|
|
278
|
+
```
|
|
83
279
|
|
|
84
|
-
|
|
85
|
-
- Pre-parsing date and time strings
|
|
280
|
+
</details>
|
|
86
281
|
|
|
87
|
-
|
|
88
|
-
|
|
282
|
+
<details>
|
|
283
|
+
<summary><strong>Output as UTC timezone</strong></summary>
|
|
89
284
|
|
|
90
|
-
|
|
91
|
-
- Format transformation of date and time strings (String -> String)
|
|
285
|
+
To output date and time as UTC timezone, specify the string `UTC` in the `timeZone` property of `FormatterOptions`.
|
|
92
286
|
|
|
93
|
-
|
|
94
|
-
|
|
287
|
+
```typescript
|
|
288
|
+
format(new Date(), 'hh:mm A [GMT]Z');
|
|
289
|
+
// => '12:14 PM GMT-0700'
|
|
95
290
|
|
|
96
|
-
|
|
97
|
-
|
|
291
|
+
format(new Date(), 'hh:mm A [GMT]Z', { timeZone: 'UTC' });
|
|
292
|
+
// => '07:14 AM GMT+0000'
|
|
293
|
+
```
|
|
98
294
|
|
|
99
|
-
|
|
100
|
-
|
|
295
|
+
</details>
|
|
296
|
+
</details>
|
|
101
297
|
|
|
102
|
-
|
|
103
|
-
- Adding hours
|
|
298
|
+
## parse(dateString, arg[, options])
|
|
104
299
|
|
|
105
|
-
|
|
106
|
-
|
|
300
|
+
<details>
|
|
301
|
+
<summary>Parses a date string according to the specified format.</summary>
|
|
107
302
|
|
|
108
|
-
-
|
|
109
|
-
-
|
|
303
|
+
- dateString
|
|
304
|
+
- type: `string`
|
|
305
|
+
- The date string to parse
|
|
306
|
+
- arg
|
|
307
|
+
- type: `string | CompiledObject`
|
|
308
|
+
- The format string or compiled object to match against the date string
|
|
309
|
+
- [options]
|
|
310
|
+
- type: `ParserOptions`
|
|
311
|
+
- Optional parser options for customization
|
|
110
312
|
|
|
111
|
-
|
|
112
|
-
|
|
313
|
+
```typescript
|
|
314
|
+
import { parse } from 'date-and-time';
|
|
315
|
+
import Paris from 'date-and-time/timezones/Europe/Paris';
|
|
316
|
+
import fr from 'date-and-time/locales/fr';
|
|
113
317
|
|
|
114
|
-
|
|
115
|
-
|
|
318
|
+
parse('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss');
|
|
319
|
+
// => Jan 02 2015 23:14:05 GMT-0800
|
|
116
320
|
|
|
117
|
-
-
|
|
118
|
-
|
|
321
|
+
parse('02-01-2015', 'DD-MM-YYYY');
|
|
322
|
+
// => Jan 02 2015 00:00:00 GMT-0800
|
|
119
323
|
|
|
120
|
-
|
|
121
|
-
|
|
324
|
+
parse('11:14:05 PM', 'h:mm:ss A', { timeZone: 'UTC' });
|
|
325
|
+
// => Jan 02 1970 23:14:05 GMT+0000
|
|
122
326
|
|
|
123
|
-
|
|
124
|
-
|
|
327
|
+
parse(
|
|
328
|
+
'02 janv. 2015, 11:14:05 PM', 'DD MMM YYYY, h:mm:ss A',
|
|
329
|
+
{ timeZone: Paris, locale: fr }
|
|
330
|
+
);
|
|
331
|
+
// => Jan 02 2015 23:14:05 GMT+0100
|
|
125
332
|
|
|
126
|
-
|
|
127
|
-
|
|
333
|
+
parse('Jam 1 2017', 'MMM D YYYY');
|
|
334
|
+
// => Invalid Date
|
|
335
|
+
```
|
|
128
336
|
|
|
129
|
-
|
|
130
|
-
|
|
337
|
+
The tokens available for use in the format string specified as the second argument and their meanings are as follows:
|
|
338
|
+
|
|
339
|
+
| Token | Meaning | Input Examples |
|
|
340
|
+
|:----------|:--------------------------------------------|:--------------------|
|
|
341
|
+
| YYYY | 4-digit year | 0999, 2015 |
|
|
342
|
+
| Y | Year without zero padding | 2, 44, 88, 2015 |
|
|
343
|
+
| MMMM | Full month name | January, December |
|
|
344
|
+
| MMM | Short month name | Jan, Dec |
|
|
345
|
+
| MM | Month | 01, 12 |
|
|
346
|
+
| M | Month without zero padding | 1, 12 |
|
|
347
|
+
| DD | Day | 02, 31 |
|
|
348
|
+
| D | Day without zero padding | 2, 31 |
|
|
349
|
+
| HH | Hour in 24-hour format | 23, 08 |
|
|
350
|
+
| H | Hour in 24-hour format without zero padding | 23, 8 |
|
|
351
|
+
| hh | Hour in 12-hour format | 11, 08 |
|
|
352
|
+
| h | Hour in 12-hour format without zero padding | 11, 8 |
|
|
353
|
+
| A | Uppercase AM/PM | AM, PM |
|
|
354
|
+
| AA | Uppercase AM/PM (with periods) | A.M., P.M. |
|
|
355
|
+
| a | Lowercase AM/PM | am, pm |
|
|
356
|
+
| aa | Lowercase AM/PM (with periods) | a.m., p.m. |
|
|
357
|
+
| mm | Minutes | 14, 07 |
|
|
358
|
+
| m | Minutes without zero padding | 14, 7 |
|
|
359
|
+
| ss | Seconds | 05, 10 |
|
|
360
|
+
| s | Seconds without zero padding | 5, 10 |
|
|
361
|
+
| SSS | 3-digit milliseconds | 753, 022 |
|
|
362
|
+
| SS | 2-digit milliseconds | 75, 02 |
|
|
363
|
+
| S | 1-digit milliseconds | 7, 0 |
|
|
364
|
+
| Z | Timezone offset | +0100, -0800 |
|
|
365
|
+
| ZZ | Timezone offset with colon | +01:00, -08:00 |
|
|
366
|
+
|
|
367
|
+
Additionally, by importing plugins, you can use the following tokens. For details, please refer to [PLUGINS.md](docs/PLUGINS.md).
|
|
368
|
+
|
|
369
|
+
| Token | Meaning | Input Examples |
|
|
370
|
+
|:----------|:-------------------------------------------|:---------------------|
|
|
371
|
+
| YY | 2-digit year | 90, 00, 08, 19 |
|
|
372
|
+
| DDD | Ordinal representation of day | 1st, 2nd, 3rd |
|
|
373
|
+
| dddd | Full day name | Friday, Sunday |
|
|
374
|
+
| ddd | Short day name | Fri, Sun |
|
|
375
|
+
| dd | Very short day name | Fr, Su |
|
|
376
|
+
| SSSSSS | 6-digit milliseconds | 123456, 000001 |
|
|
377
|
+
| SSSSS | 5-digit milliseconds | 12345, 00001 |
|
|
378
|
+
| SSSS | 4-digit milliseconds | 1234, 0001 |
|
|
379
|
+
| fff | 3-digit microseconds | 753, 022 |
|
|
380
|
+
| ff | 2-digit microseconds | 75, 02 |
|
|
381
|
+
| f | 1-digit microseconds | 7, 0 |
|
|
382
|
+
| SSSSSSSSS | 9-digit milliseconds | 123456789, 000000001 |
|
|
383
|
+
| SSSSSSSS | 8-digit milliseconds | 12345678, 00000001 |
|
|
384
|
+
| SSSSSSS | 7-digit milliseconds | 1234567, 0000001 |
|
|
385
|
+
| FFF | 3-digit nanoseconds | 753, 022 |
|
|
386
|
+
| FF | 2-digit nanoseconds | 75, 02 |
|
|
387
|
+
| F | 1-digit nanoseconds | 7, 0 |
|
|
388
|
+
|
|
389
|
+
The breakdown of `ParserOptions` that can be specified as the third argument is as follows:
|
|
390
|
+
|
|
391
|
+
<details>
|
|
392
|
+
<summary><strong>hour12</strong></summary>
|
|
393
|
+
|
|
394
|
+
- type: `h11 | h12`
|
|
395
|
+
- default: `h12`
|
|
396
|
+
- The hour format to use for parsing. This is used when the hour is in 12-hour format. It can be `h11` for 11-hour format (0 - 11) or `h12` for 12-hour format (1 - 12).
|
|
397
|
+
|
|
398
|
+
```typescript
|
|
399
|
+
parse('0:12:54 PM', 'h:mm:ss A', { hour12: 'h11' });
|
|
400
|
+
// => Jan 01 1970 12:12:54 GMT-0800
|
|
401
|
+
```
|
|
131
402
|
|
|
132
|
-
|
|
403
|
+
</details>
|
|
133
404
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
- @param {**boolean**} [utc] - Output as UTC
|
|
137
|
-
- @returns {**string**} A formatted string
|
|
405
|
+
<details>
|
|
406
|
+
<summary><strong>hour24</strong></summary>
|
|
138
407
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
408
|
+
- type: `h23 | h24`
|
|
409
|
+
- default: `h23`
|
|
410
|
+
- The hour format to use for parsing. This is used when the hour is in 24-hour format. It can be `h23` for 23-hour format (0 - 23) or `h24` for 24-hour format (1 - 24).
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
parse('24:12:54', 'h:mm:ss', { hour24: 'h24' });
|
|
414
|
+
// => Jan 01 1970 00:12:54 GMT-0800
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
</details>
|
|
418
|
+
|
|
419
|
+
<details>
|
|
420
|
+
<summary><strong>numeral</strong></summary>
|
|
421
|
+
|
|
422
|
+
- type: `Numeral`
|
|
423
|
+
- default: `latn`
|
|
424
|
+
- The numeral system to use for parsing numbers. This is an object that provides methods to encode and decode numbers in the specified numeral system.
|
|
425
|
+
|
|
426
|
+
```typescript
|
|
427
|
+
import arab from 'date-and-time/numerals/arab';
|
|
428
|
+
|
|
429
|
+
parse('٠٨/٠٧/٢٠٢٥', 'DD/MM/YYYY', { numeral: arab });
|
|
430
|
+
// => July 09 2025 00:00:00 GMT-0700
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Currently, the following numeral systems are supported:
|
|
434
|
+
|
|
435
|
+
- `arab`
|
|
436
|
+
- `arabext`
|
|
437
|
+
- `beng`
|
|
438
|
+
- `latn`
|
|
439
|
+
- `mymr`
|
|
440
|
+
|
|
441
|
+
</details>
|
|
442
|
+
|
|
443
|
+
<details>
|
|
444
|
+
<summary><strong>calendar</strong></summary>
|
|
445
|
+
|
|
446
|
+
- type: `buddhist | gregory`
|
|
447
|
+
- default: `gregory`
|
|
448
|
+
- The calendar system to use for parsing dates. This can be `buddhist` for Buddhist calendar or `gregory` for Gregorian calendar.
|
|
449
|
+
|
|
450
|
+
```typescript
|
|
451
|
+
parse('July 09 2025', 'MMMM DD YYYY', { calendar: 'buddhist' });
|
|
452
|
+
// => July 09 1482 00:00:00 GMT-0752
|
|
453
|
+
// Note: Buddhist calendar is 543 years ahead of Gregorian calendar,
|
|
454
|
+
// so 2025 BE (Buddhist Era) equals 1482 CE (Common Era)
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
</details>
|
|
458
|
+
|
|
459
|
+
<details>
|
|
460
|
+
<summary><strong>ignoreCase</strong></summary>
|
|
461
|
+
|
|
462
|
+
- type: `boolean`
|
|
463
|
+
- default: `false`
|
|
464
|
+
- Whether to ignore case when matching strings. This is useful for matching month names, day names, and meridiems in a case-insensitive manner. If true, the parser will convert both the input string and the strings in the locale to lowercase before matching.
|
|
465
|
+
|
|
466
|
+
```typescript
|
|
467
|
+
parse('july 09 2025', 'MMMM DD YYYY', { ignoreCase: true });
|
|
468
|
+
// => July 09 2025 00:00:00 GMT-0700
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
</details>
|
|
472
|
+
|
|
473
|
+
<details>
|
|
474
|
+
<summary><strong>timeZone</strong></summary>
|
|
475
|
+
|
|
476
|
+
- type: `TimeZone | UTC`
|
|
477
|
+
- default: `undefined`
|
|
478
|
+
- The time zone to use for parsing dates and times. This can be a specific time zone object or `UTC` to use Coordinated Universal Time. If not specified, it defaults to undefined, which means the local time zone will be used.
|
|
479
|
+
|
|
480
|
+
```typescript
|
|
481
|
+
import New_York from 'date-and-time/timezones/America/New_York';
|
|
482
|
+
|
|
483
|
+
parse('July 09 2025, 12:34:56', 'MMMM D YYYY, H:mm:ss', { timeZone: New_York });
|
|
484
|
+
// => July 09 2025 09:34:56 GMT-0700 (July 09 2025 12:34:56 GMT-0400)
|
|
485
|
+
|
|
486
|
+
parse('July 09 2025, 12:34:56', 'MMMM D YYYY, H:mm:ss', { timeZone: 'UTC' });
|
|
487
|
+
// => July 09 2025 05:34:56 GMT-0700 (July 09 2025 12:34:56 GMT+0000)
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
</details>
|
|
491
|
+
|
|
492
|
+
<details>
|
|
493
|
+
<summary><strong>locale</strong></summary>
|
|
494
|
+
|
|
495
|
+
- type: `Locale`
|
|
496
|
+
- default: `en`
|
|
497
|
+
- The locale to use for parsing dates and times. This is an object that provides methods to get localized month names, day names, and meridiems.
|
|
498
|
+
|
|
499
|
+
```typescript
|
|
500
|
+
import es from 'date-and-time/locales/es';
|
|
501
|
+
|
|
502
|
+
parse(
|
|
503
|
+
'23 de julio de 2025, 12:38:08,533 a.m. GMT-07:00',
|
|
504
|
+
'D [de] MMMM [de] YYYY, h:mm:ss,SSS aa [GMT]ZZ',
|
|
505
|
+
{ locale: es }
|
|
506
|
+
);
|
|
507
|
+
// => July 23 2025 12:38:08.533 GMT-0700
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
<details>
|
|
511
|
+
<summary>Currently, the following locales are supported:</summary>
|
|
512
|
+
|
|
513
|
+
- `ar` (Arabic)
|
|
514
|
+
- `az` (Azerbaijani)
|
|
515
|
+
- `bn` (Bengali)
|
|
516
|
+
- `cs` (Czech)
|
|
517
|
+
- `da` (Danish)
|
|
518
|
+
- `de` (German)
|
|
519
|
+
- `el` (Greek)
|
|
520
|
+
- `en` (English)
|
|
521
|
+
- `es` (Spanish)
|
|
522
|
+
- `fa` (Persian)
|
|
523
|
+
- `fi` (Finnish)
|
|
524
|
+
- `fr` (French)
|
|
525
|
+
- `he` (Hebrew)
|
|
526
|
+
- `hi` (Hindi)
|
|
527
|
+
- `hu` (Hungarian)
|
|
528
|
+
- `id` (Indonesian)
|
|
529
|
+
- `it` (Italian)
|
|
530
|
+
- `ja` (Japanese)
|
|
531
|
+
- `ko` (Korean)
|
|
532
|
+
- `ms` (Malay)
|
|
533
|
+
- `my` (Burmese)
|
|
534
|
+
- `nl` (Dutch)
|
|
535
|
+
- `no` (Norwegian)
|
|
536
|
+
- `pl` (Polish)
|
|
537
|
+
- `pt-BR` (Brazilian Portuguese)
|
|
538
|
+
- `pt-PT` (European Portuguese)
|
|
539
|
+
- `ro` (Romanian)
|
|
540
|
+
- `ru` (Russian)
|
|
541
|
+
- `rw` (Kinyarwanda)
|
|
542
|
+
- `sr-Cyrl` (Serbian Cyrillic)
|
|
543
|
+
- `sr-Latn` (Serbian Latin)
|
|
544
|
+
- `sv` (Swedish)
|
|
545
|
+
- `ta` (Tamil)
|
|
546
|
+
- `th` (Thai)
|
|
547
|
+
- `tr` (Turkish)
|
|
548
|
+
- `uk` (Ukrainian)
|
|
549
|
+
- `uz-Cyrl` (Uzbek Cyrillic)
|
|
550
|
+
- `uz-Latn` (Uzbek Latin)
|
|
551
|
+
- `vi` (Vietnamese)
|
|
552
|
+
- `zh-Hans` (Simplified Chinese)
|
|
553
|
+
- `zh-Hant` (Traditional Chinese)
|
|
554
|
+
|
|
555
|
+
</details>
|
|
556
|
+
</details>
|
|
557
|
+
|
|
558
|
+
### Notes
|
|
559
|
+
|
|
560
|
+
<details>
|
|
561
|
+
<summary><strong>When parsing fails</strong></summary>
|
|
274
562
|
|
|
275
563
|
If this function fails to parse, it will return `Invalid Date`. Notice that the `Invalid Date` is a Date object, not `NaN` or `null`. You can tell whether the Date object is invalid as follows:
|
|
276
564
|
|
|
277
|
-
```
|
|
278
|
-
const today =
|
|
565
|
+
```typescript
|
|
566
|
+
const today = parse('Jam 1 2017', 'MMM D YYYY');
|
|
279
567
|
|
|
280
568
|
if (isNaN(today.getTime())) {
|
|
281
|
-
|
|
569
|
+
console.error('Parsing failed');
|
|
282
570
|
}
|
|
283
571
|
```
|
|
284
572
|
|
|
285
|
-
|
|
573
|
+
</details>
|
|
574
|
+
|
|
575
|
+
<details>
|
|
576
|
+
<summary><strong>Input as UTC timezone</strong></summary>
|
|
577
|
+
|
|
578
|
+
If the `dateString` does not contain a timezone offset and the `timeZone` property of the third argument is not specified, this function considers the `dateString` to be in the local timezone. If you want to process a `dateString` without a timezone offset as UTC timezone, set the string `UTC` to the `timeZone` property in the third argument. Note that the timezone offset contained in the `dateString` takes precedence over the `timeZone` property of the third argument.
|
|
286
579
|
|
|
287
|
-
|
|
580
|
+
```typescript
|
|
581
|
+
parse('11:14:05 PM', 'hh:mm:ss A');
|
|
582
|
+
// => Jan 1 1970 23:14:05 GMT-0800
|
|
288
583
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
584
|
+
parse('11:14:05 PM GMT+0000', 'hh:mm:ss A [GMT]Z');
|
|
585
|
+
// => Jan 1 1970 23:14:05 GMT+0000
|
|
586
|
+
|
|
587
|
+
parse('11:14:05 PM', 'hh:mm:ss A', { timeZone: 'UTC' });
|
|
588
|
+
// => Jan 1 1970 23:14:05 GMT+0000
|
|
292
589
|
```
|
|
293
590
|
|
|
294
|
-
|
|
591
|
+
</details>
|
|
592
|
+
|
|
593
|
+
<details>
|
|
594
|
+
<summary><strong>Default Date Time</strong></summary>
|
|
295
595
|
|
|
296
|
-
Default date is `January 1, 1970`, time is `00:00:00.000`.
|
|
596
|
+
Default date is `January 1, 1970`, time is `00:00:00.000`. Any date/time components not specified in the input string will be filled with these default values.
|
|
297
597
|
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
|
|
598
|
+
```typescript
|
|
599
|
+
parse('11:14:05 PM', 'hh:mm:ss A');
|
|
600
|
+
// => Jan 1 1970 23:14:05 GMT-0800
|
|
601
|
+
|
|
602
|
+
parse('Feb 2000', 'MMM YYYY');
|
|
603
|
+
// => Feb 1 2000 00:00:00 GMT-0800
|
|
301
604
|
```
|
|
302
605
|
|
|
303
|
-
|
|
606
|
+
</details>
|
|
607
|
+
|
|
608
|
+
<details>
|
|
609
|
+
<summary><strong>Max Date / Min Date</strong></summary>
|
|
304
610
|
|
|
305
|
-
|
|
611
|
+
The parsable maximum date is `December 31, 9999`, and the minimum date is `January 1, 0001`.
|
|
306
612
|
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
|
|
613
|
+
```typescript
|
|
614
|
+
parse('Dec 31 9999', 'MMM D YYYY');
|
|
615
|
+
// => Dec 31 9999 00:00:00 GMT-0800
|
|
310
616
|
|
|
311
|
-
|
|
312
|
-
|
|
617
|
+
parse('Dec 31 10000', 'MMM D YYYY');
|
|
618
|
+
// => Invalid Date
|
|
619
|
+
|
|
620
|
+
parse('Jan 1 0001', 'MMM D YYYY');
|
|
621
|
+
// => Jan 1 0001 00:00:00 GMT-0800
|
|
622
|
+
|
|
623
|
+
parse('Jan 1 0000', 'MMM D YYYY');
|
|
624
|
+
// => Invalid Date
|
|
313
625
|
```
|
|
314
626
|
|
|
315
|
-
|
|
627
|
+
</details>
|
|
628
|
+
|
|
629
|
+
<details>
|
|
630
|
+
<summary><strong>12-hour notation and Meridiem</strong></summary>
|
|
316
631
|
|
|
317
|
-
If use `hh` or `h` (12-hour) token, use together `A` (meridiem) token to get the
|
|
632
|
+
If you use the `hh` or `h` (12-hour) token, use it together with the `A` (meridiem) token to get the correct value.
|
|
318
633
|
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
|
|
634
|
+
```typescript
|
|
635
|
+
parse('11:14:05', 'hh:mm:ss');
|
|
636
|
+
// => Jan 1 1970 11:14:05 GMT-0800
|
|
637
|
+
|
|
638
|
+
parse('11:14:05 PM', 'hh:mm:ss A');
|
|
639
|
+
// => Jan 1 1970 23:14:05 GMT-0800
|
|
322
640
|
```
|
|
323
641
|
|
|
324
|
-
|
|
642
|
+
</details>
|
|
643
|
+
|
|
644
|
+
<details>
|
|
645
|
+
<summary><strong>Token invalidation</strong></summary>
|
|
325
646
|
|
|
326
647
|
Any part of the given format string that you do not want to be recognized as a token should be enclosed in square brackets. They are considered comments and will not be parsed.
|
|
327
648
|
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
|
|
649
|
+
```typescript
|
|
650
|
+
parse('12 hours 34 minutes', 'HH hours mm minutes');
|
|
651
|
+
// => Invalid Date
|
|
652
|
+
|
|
653
|
+
parse('12 hours 34 minutes', 'HH [hours] mm [minutes]');
|
|
654
|
+
// => Jan 1 1970 12:34:00 GMT-0800
|
|
331
655
|
```
|
|
332
656
|
|
|
333
|
-
|
|
657
|
+
</details>
|
|
334
658
|
|
|
335
|
-
|
|
659
|
+
<details>
|
|
660
|
+
<summary><strong>Wildcard</strong></summary>
|
|
336
661
|
|
|
337
|
-
|
|
662
|
+
Whitespace acts as a wildcard token. This token will skip parsing the corresponding parts of the date and time strings. This behavior is similar to enclosing part of a format string in square brackets (Token invalidation), but with the flexibility that the contents do not have to match exactly - only the character count needs to match between the format string and input string.
|
|
663
|
+
|
|
664
|
+
```typescript
|
|
338
665
|
// This will be an error.
|
|
339
|
-
|
|
340
|
-
//
|
|
341
|
-
|
|
666
|
+
parse('2015/01/02 11:14:05', 'YYYY/MM/DD');
|
|
667
|
+
// => Invalid Date
|
|
668
|
+
|
|
669
|
+
parse('2015/01/02 11:14:05', 'YYYY/MM/DD ');
|
|
670
|
+
// => Jan 2 2015 00:00:00 GMT-0800
|
|
342
671
|
```
|
|
343
672
|
|
|
344
|
-
|
|
673
|
+
</details>
|
|
674
|
+
|
|
675
|
+
<details>
|
|
676
|
+
<summary><strong>Ellipsis</strong></summary>
|
|
345
677
|
|
|
346
|
-
`...` token ignores subsequent corresponding date and time strings. Use this token only at the end of a format string. The above example can be
|
|
678
|
+
`...` token ignores subsequent corresponding date and time strings. Use this token only at the end of a format string. The above example can also be written like this:
|
|
347
679
|
|
|
348
|
-
```
|
|
349
|
-
|
|
680
|
+
```typescript
|
|
681
|
+
parse('2015/01/02 11:14:05', 'YYYY/MM/DD...');
|
|
682
|
+
// => Jan 2 2015 00:00:00 GMT-0800
|
|
350
683
|
```
|
|
351
684
|
|
|
352
|
-
|
|
685
|
+
</details>
|
|
686
|
+
</details>
|
|
353
687
|
|
|
354
|
-
|
|
355
|
-
- @returns {**Array.\<string\>**} A compiled object
|
|
688
|
+
## compile(formatString)
|
|
356
689
|
|
|
357
|
-
|
|
690
|
+
<details>
|
|
691
|
+
<summary>Compiles a format string into a tokenized array for efficient parsing and formatting.</summary>
|
|
358
692
|
|
|
359
|
-
|
|
360
|
-
|
|
693
|
+
- formatString
|
|
694
|
+
- type: `string`
|
|
695
|
+
- The format string to compile
|
|
361
696
|
|
|
362
|
-
|
|
363
|
-
date.parse('Jul 27 2019 4:15:24 AM', pattern);
|
|
364
|
-
date.parse('Dec 25 2019 3:51:11 AM', pattern);
|
|
697
|
+
If you are going to execute the `format`, `parse`, or `isValid` functions many times with one string format, it is recommended to precompile and reuse it for performance.
|
|
365
698
|
|
|
366
|
-
|
|
699
|
+
```typescript
|
|
700
|
+
import { compile, parse, format } from 'date-and-time';
|
|
701
|
+
|
|
702
|
+
const pattern = compile('MMM D YYYY h:m:s A');
|
|
703
|
+
|
|
704
|
+
parse('Mar 22 2019 2:54:21 PM', pattern);
|
|
705
|
+
parse('Jul 27 2019 4:15:24 AM', pattern);
|
|
706
|
+
parse('Dec 25 2019 3:51:11 AM', pattern);
|
|
707
|
+
|
|
708
|
+
format(new Date(), pattern);
|
|
709
|
+
// => Mar 16 2020 6:24:56 PM
|
|
367
710
|
```
|
|
368
711
|
|
|
369
|
-
|
|
712
|
+
</details>
|
|
713
|
+
|
|
714
|
+
## preparse(dateString, arg[, options])
|
|
370
715
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
- @returns {**Object**} A pre-parsed result object
|
|
716
|
+
<details>
|
|
717
|
+
<summary>Preparses a date string according to the specified pattern.</summary>
|
|
374
718
|
|
|
375
|
-
|
|
719
|
+
- dateString
|
|
720
|
+
- type: `string`
|
|
721
|
+
- The date string to preparse
|
|
722
|
+
- arg
|
|
723
|
+
- type: `string | CompiledObject`
|
|
724
|
+
- The pattern string or compiled object to match against the date string
|
|
725
|
+
- [options]
|
|
726
|
+
- type: `ParserOptions`
|
|
727
|
+
- Optional parser options
|
|
376
728
|
|
|
377
|
-
```
|
|
378
|
-
|
|
729
|
+
```typescript
|
|
730
|
+
import { preparse } from 'date-and-time';
|
|
731
|
+
|
|
732
|
+
preparse('Jan 2015 02 23:14:05 GMT-0800', 'MMM YYYY DD HH:mm:ss [GMT]Z');
|
|
379
733
|
|
|
380
734
|
{
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
_index: 33, // Pointer offset
|
|
392
|
-
_length: 33, // Length of the date string
|
|
393
|
-
_match: 7 // Token matching count
|
|
735
|
+
Y: 2015, // Year
|
|
736
|
+
M: 1, // Month
|
|
737
|
+
D: 2, // Day
|
|
738
|
+
H: 23, // Hour (24-hour)
|
|
739
|
+
m: 14, // Minute
|
|
740
|
+
s: 5, // Second
|
|
741
|
+
Z: 480, // Timezone offset in minutes
|
|
742
|
+
_index: 29, // Current parsing position
|
|
743
|
+
_length: 29, // Total length of date string
|
|
744
|
+
_match: 7 // Number of matched tokens
|
|
394
745
|
}
|
|
395
746
|
```
|
|
396
747
|
|
|
397
|
-
This date structure provides a parsing result. You will be able to tell from it how the date string was parsed(
|
|
748
|
+
This date structure provides a parsing result. You will be able to tell from it how the date string was parsed (or why the parsing failed).
|
|
749
|
+
|
|
750
|
+
</details>
|
|
398
751
|
|
|
399
|
-
|
|
752
|
+
## isValid(dateString, arg[, options])
|
|
400
753
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
- @returns {**boolean**} Whether the date and time string is a valid date and time
|
|
754
|
+
<details>
|
|
755
|
+
<summary>Validates whether a date string is valid according to the specified format.</summary>
|
|
404
756
|
|
|
405
|
-
|
|
757
|
+
- dateString
|
|
758
|
+
- type: `string`
|
|
759
|
+
- The date string to validate
|
|
760
|
+
- arg
|
|
761
|
+
- type: `string | CompiledObject`
|
|
762
|
+
- The format string or compiled object
|
|
763
|
+
- [options]
|
|
764
|
+
- type: `ParserOptions`
|
|
765
|
+
- Optional parser options
|
|
406
766
|
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
|
|
767
|
+
```typescript
|
|
768
|
+
isValid('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss'); // => true
|
|
769
|
+
isValid('29-02-2015', 'DD-MM-YYYY'); // => false
|
|
410
770
|
```
|
|
411
771
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
772
|
+
For details about `ParserOptions`, refer to the `parse` function section.
|
|
773
|
+
|
|
774
|
+
</details>
|
|
775
|
+
|
|
776
|
+
## transform(dateString, arg1, arg2[, options1[, options2]])
|
|
777
|
+
|
|
778
|
+
<details>
|
|
779
|
+
<summary>Transforms a date string from one format to another.</summary>
|
|
780
|
+
|
|
781
|
+
- dateString
|
|
782
|
+
- type: `string`
|
|
783
|
+
- The date string to transform
|
|
784
|
+
- arg1
|
|
785
|
+
- type: `string | CompiledObject`
|
|
786
|
+
- The format string or compiled object for parsing
|
|
787
|
+
- arg2
|
|
788
|
+
- type: `string | CompiledObject`
|
|
789
|
+
- The format string or compiled object for formatting
|
|
790
|
+
- [options1]
|
|
791
|
+
- type: `ParserOptions`
|
|
792
|
+
- Optional parser options
|
|
793
|
+
- [options2]
|
|
794
|
+
- type: `FormatterOptions`
|
|
795
|
+
- Optional formatter options
|
|
796
|
+
|
|
797
|
+
This is a syntactic sugar for combining `parse` and `format` processing to convert date formats in a single function. It converts `dateString` to `arg2` format. Actually, it parses the `dateString` in `arg1` format and then formats it in `arg2` format.
|
|
798
|
+
|
|
799
|
+
```typescript
|
|
800
|
+
import { transform } from 'date-and-time';
|
|
801
|
+
import New_York from 'date-and-time/timezones/America/New_York';
|
|
802
|
+
import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
|
|
803
|
+
|
|
804
|
+
// Swap the order of month and day
|
|
805
|
+
transform('3/8/2020', 'D/M/YYYY', 'M/D/YYYY');
|
|
806
|
+
// => 8/3/2020
|
|
807
|
+
|
|
808
|
+
// Convert 24-hour format to 12-hour format
|
|
809
|
+
transform('13:05', 'HH:mm', 'hh:mm A');
|
|
810
|
+
// => 01:05 PM
|
|
811
|
+
|
|
812
|
+
// Convert EST to PST
|
|
813
|
+
transform(
|
|
814
|
+
'3/8/2020 1:05 PM', 'D/M/YYYY h:mm A', 'D/M/YYYY h:mm A',
|
|
815
|
+
{ timeZone: New_York }, { timeZone: Los_Angeles }
|
|
816
|
+
);
|
|
817
|
+
// => 3/8/2020 10:05 AM
|
|
415
818
|
```
|
|
416
819
|
|
|
417
|
-
|
|
820
|
+
For details about `ParserOptions`, refer to the `parse` function section. For details about `FormatterOptions`, refer to the `format` function section.
|
|
418
821
|
|
|
419
|
-
|
|
420
|
-
- @param {**string|Array.\<string\>**} arg1 - A format string or its compiled object before transformation
|
|
421
|
-
- @param {**string|Array.\<string\>**} arg2 - A format string or its compiled object after transformation
|
|
422
|
-
- @param {**boolean**} [utc] - Output as UTC
|
|
423
|
-
- @returns {**string**} A formatted string
|
|
822
|
+
</details>
|
|
424
823
|
|
|
425
|
-
|
|
824
|
+
## addYears(dateObj, years[, timeZone])
|
|
426
825
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
date.transform('3/8/2020', 'D/M/YYYY', 'M/D/YYYY');
|
|
826
|
+
<details>
|
|
827
|
+
<summary>Adds the specified number of years to a Date object.</summary>
|
|
430
828
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
829
|
+
- dateObj
|
|
830
|
+
- type: `Date`
|
|
831
|
+
- The Date object to modify
|
|
832
|
+
- years
|
|
833
|
+
- type: `number`
|
|
834
|
+
- The number of years to add
|
|
835
|
+
- [timeZone]
|
|
836
|
+
- type: `TimeZone | UTC`
|
|
837
|
+
- Optional time zone object or `UTC`
|
|
434
838
|
|
|
435
|
-
|
|
839
|
+
```typescript
|
|
840
|
+
import { addYears } from 'date-and-time';
|
|
841
|
+
import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
|
|
436
842
|
|
|
437
|
-
|
|
438
|
-
- @param {**number**} years - The number of years to add
|
|
439
|
-
- @param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`
|
|
440
|
-
- @returns {**Date**} The Date object after adding the specified number of years
|
|
843
|
+
const now = new Date(2024, 2, 11, 1); // => Mar 11 2024 01:00:00 GMT-07:00
|
|
441
844
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
```javascript
|
|
445
|
-
const now = new Date();
|
|
446
|
-
const next_year = date.addYears(now, 1);
|
|
845
|
+
addYears(now, 1, Los_Angeles); // => Mar 11 2025 01:00:00 GMT-07:00
|
|
846
|
+
addYears(now, -1, Los_Angeles); // => Mar 11 2023 01:00:00 GMT-08:00
|
|
447
847
|
```
|
|
448
848
|
|
|
449
849
|
Exceptional behavior of the calculation for the last day of the month:
|
|
450
850
|
|
|
451
|
-
```
|
|
452
|
-
const now = new Date(Date.UTC(2020, 1, 29));
|
|
453
|
-
const
|
|
454
|
-
const
|
|
851
|
+
```typescript
|
|
852
|
+
const now = new Date(Date.UTC(2020, 1, 29)); // => Feb 29 2020
|
|
853
|
+
const next = addYears(now, 1, 'UTC'); // => Feb 28 2021
|
|
854
|
+
const back = addYears(next, -1, 'UTC'); // => Feb 28 2020 (not the original date)
|
|
455
855
|
```
|
|
456
856
|
|
|
457
|
-
|
|
857
|
+
</details>
|
|
458
858
|
|
|
459
|
-
|
|
460
|
-
- @param {**number**} months - The number of months to add
|
|
461
|
-
- @param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`
|
|
462
|
-
- @returns {**Date**} The Date object after adding the specified number of months
|
|
859
|
+
## addMonths(dateObj, months[, timeZone])
|
|
463
860
|
|
|
464
|
-
|
|
861
|
+
<details>
|
|
862
|
+
<summary>Adds the specified number of months to a Date object.</summary>
|
|
465
863
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
864
|
+
- dateObj
|
|
865
|
+
- type: `Date`
|
|
866
|
+
- The Date object to modify
|
|
867
|
+
- months
|
|
868
|
+
- type: `number`
|
|
869
|
+
- The number of months to add
|
|
870
|
+
- [timeZone]
|
|
871
|
+
- type: `TimeZone | UTC`
|
|
872
|
+
- Optional time zone object or `UTC`
|
|
873
|
+
|
|
874
|
+
```typescript
|
|
875
|
+
import { addMonths } from 'date-and-time';
|
|
876
|
+
import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
|
|
877
|
+
|
|
878
|
+
const now = new Date(2024, 2, 11, 1); // => Mar 11 2024 01:00:00 GMT-07:00
|
|
879
|
+
|
|
880
|
+
addMonths(now, 1, Los_Angeles); // => Apr 11 2024 01:00:00 GMT-07:00
|
|
881
|
+
addMonths(now, -1, Los_Angeles); // => Feb 11 2024 01:00:00 GMT-08:00
|
|
469
882
|
```
|
|
470
883
|
|
|
471
884
|
Exceptional behavior of the calculation for the last day of the month:
|
|
472
885
|
|
|
473
|
-
```
|
|
474
|
-
const now = new Date(Date.UTC(2023, 0, 31));
|
|
475
|
-
const
|
|
476
|
-
const
|
|
886
|
+
```typescript
|
|
887
|
+
const now = new Date(Date.UTC(2023, 0, 31)); // => Jan 31 2023
|
|
888
|
+
const apr = addMonths(now, 3, 'UTC'); // => Apr 30 2023
|
|
889
|
+
const feb = addMonths(apr, -2, 'UTC'); // => Feb 28 2023
|
|
477
890
|
```
|
|
478
891
|
|
|
479
|
-
|
|
892
|
+
</details>
|
|
480
893
|
|
|
481
|
-
|
|
482
|
-
- @param {**number**} days - The number of days to add
|
|
483
|
-
- @param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`
|
|
484
|
-
- @returns {**Date**} The Date object after adding the specified number of days
|
|
894
|
+
## addDays(dateObj, days[, timeZone])
|
|
485
895
|
|
|
486
|
-
|
|
896
|
+
<details>
|
|
897
|
+
<summary>Adds the specified number of days to a Date object.</summary>
|
|
487
898
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
899
|
+
- dateObj
|
|
900
|
+
- type: `Date`
|
|
901
|
+
- The Date object to modify
|
|
902
|
+
- days
|
|
903
|
+
- type: `number`
|
|
904
|
+
- The number of days to add
|
|
905
|
+
- [timeZone]
|
|
906
|
+
- type: `TimeZone | UTC`
|
|
907
|
+
- Optional time zone object or `UTC`
|
|
908
|
+
|
|
909
|
+
```typescript
|
|
910
|
+
import { addDays } from 'date-and-time';
|
|
911
|
+
import Los_Angeles from 'date-and-time/timezones/America/Los_Angeles';
|
|
912
|
+
|
|
913
|
+
const now = new Date(2024, 2, 11, 1); // => Mar 11 2024 01:00:00 GMT-07:00
|
|
914
|
+
|
|
915
|
+
addDays(now, 1, Los_Angeles); // => Mar 12 2024 01:00:00 GMT-07:00
|
|
916
|
+
addDays(now, -1, Los_Angeles); // => Mar 10 2024 01:00:00 GMT-08:00
|
|
491
917
|
```
|
|
492
918
|
|
|
493
|
-
|
|
919
|
+
</details>
|
|
494
920
|
|
|
495
|
-
|
|
496
|
-
- @param {**number**} hours - The number of hours to add
|
|
497
|
-
- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
|
|
498
|
-
- @returns {**Date**} The Date object after adding the specified number of hours
|
|
921
|
+
## addHours(dateObj, hours)
|
|
499
922
|
|
|
500
|
-
|
|
923
|
+
<details>
|
|
924
|
+
<summary>Adds the specified number of hours to a Date object.</summary>
|
|
501
925
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
926
|
+
- dateObj
|
|
927
|
+
- type: `Date`
|
|
928
|
+
- The Date object to modify
|
|
929
|
+
- hours
|
|
930
|
+
- type: `number`
|
|
931
|
+
- The number of hours to add
|
|
932
|
+
|
|
933
|
+
```typescript
|
|
934
|
+
import { addHours } from 'date-and-time';
|
|
935
|
+
|
|
936
|
+
const now = new Date(2025, 6, 24); // => Jul 24 2025 00:00:00
|
|
937
|
+
|
|
938
|
+
addHours(now, -1); // => Jul 23 2025 23:00:00
|
|
505
939
|
```
|
|
506
940
|
|
|
507
|
-
|
|
941
|
+
</details>
|
|
508
942
|
|
|
509
|
-
|
|
510
|
-
- @param {**number**} minutes - The number of minutes to add
|
|
511
|
-
- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
|
|
512
|
-
- @returns {**Date**} The Date object after adding the specified number of minutes
|
|
943
|
+
## addMinutes(dateObj, minutes)
|
|
513
944
|
|
|
514
|
-
|
|
945
|
+
<details>
|
|
946
|
+
<summary>Adds the specified number of minutes to a Date object.</summary>
|
|
515
947
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
948
|
+
- dateObj
|
|
949
|
+
- type: `Date`
|
|
950
|
+
- The Date object to modify
|
|
951
|
+
- minutes
|
|
952
|
+
- type: `number`
|
|
953
|
+
- The number of minutes to add
|
|
954
|
+
|
|
955
|
+
```typescript
|
|
956
|
+
import { addMinutes } from 'date-and-time';
|
|
957
|
+
|
|
958
|
+
const now = new Date(2025, 6, 24); // => Jul 24 2025 00:00:00
|
|
959
|
+
|
|
960
|
+
addMinutes(now, 2); // => Jul 24 2025 00:02:00
|
|
519
961
|
```
|
|
520
962
|
|
|
521
|
-
|
|
963
|
+
</details>
|
|
522
964
|
|
|
523
|
-
|
|
524
|
-
- @param {**number**} seconds - The number of seconds to add
|
|
525
|
-
- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
|
|
526
|
-
- @returns {**Date**} The Date object after adding the specified number of seconds
|
|
965
|
+
## addSeconds(dateObj, seconds)
|
|
527
966
|
|
|
528
|
-
|
|
967
|
+
<details>
|
|
968
|
+
<summary>Adds the specified number of seconds to a Date object.</summary>
|
|
529
969
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
970
|
+
- dateObj
|
|
971
|
+
- type: `Date`
|
|
972
|
+
- The Date object to modify
|
|
973
|
+
- seconds
|
|
974
|
+
- type: `number`
|
|
975
|
+
- The number of seconds to add
|
|
976
|
+
|
|
977
|
+
```typescript
|
|
978
|
+
import { addSeconds } from 'date-and-time';
|
|
979
|
+
|
|
980
|
+
const now = new Date(2025, 6, 24); // => Jul 24 2025 00:00:00
|
|
981
|
+
|
|
982
|
+
addSeconds(now, -3); // => Jul 23 2025 23:59:57
|
|
533
983
|
```
|
|
534
984
|
|
|
535
|
-
|
|
985
|
+
</details>
|
|
536
986
|
|
|
537
|
-
|
|
538
|
-
- @param {**number**} milliseconds - The number of milliseconds to add
|
|
539
|
-
- ~~@param {**boolean**} [utc] - If true, calculates the date in UTC `Added in: v3.0.0`~~ `Removed in: v3.5.0`
|
|
540
|
-
- @returns {**Date**} The Date object after adding the specified number of milliseconds
|
|
987
|
+
## addMilliseconds(dateObj, milliseconds)
|
|
541
988
|
|
|
542
|
-
|
|
989
|
+
<details>
|
|
990
|
+
<summary>Adds the specified number of milliseconds to a Date object.</summary>
|
|
543
991
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
992
|
+
- dateObj
|
|
993
|
+
- type: `Date`
|
|
994
|
+
- The Date object to modify
|
|
995
|
+
- milliseconds
|
|
996
|
+
- type: `number`
|
|
997
|
+
- The number of milliseconds to add
|
|
998
|
+
|
|
999
|
+
```typescript
|
|
1000
|
+
import { addMilliseconds } from 'date-and-time';
|
|
1001
|
+
|
|
1002
|
+
const now = new Date(2025, 6, 24); // => Jul 24 2025 00:00:00.000
|
|
1003
|
+
|
|
1004
|
+
addMilliseconds(now, 123); // => Jul 24 2025 00:00:00.123
|
|
547
1005
|
```
|
|
548
1006
|
|
|
549
|
-
|
|
1007
|
+
</details>
|
|
1008
|
+
|
|
1009
|
+
## subtract(from, to)
|
|
550
1010
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
1011
|
+
<details>
|
|
1012
|
+
<summary>Calculates the difference between two dates.</summary>
|
|
1013
|
+
|
|
1014
|
+
- from
|
|
1015
|
+
- type: `Date`
|
|
1016
|
+
- The first Date object
|
|
1017
|
+
- to
|
|
1018
|
+
- type: `Date`
|
|
1019
|
+
- The second Date object
|
|
1020
|
+
|
|
1021
|
+
Returns a `Duration` instance with methods to get the difference in various units.
|
|
1022
|
+
|
|
1023
|
+
```typescript
|
|
1024
|
+
import { subtract } from 'date-and-time';
|
|
554
1025
|
|
|
555
|
-
```javascript
|
|
556
|
-
const today = new Date(2015, 0, 2);
|
|
557
1026
|
const yesterday = new Date(2015, 0, 1);
|
|
1027
|
+
const today = new Date(2015, 0, 2, 3, 4, 5, 6);
|
|
1028
|
+
|
|
1029
|
+
const duration = subtract(yesterday, today);
|
|
1030
|
+
|
|
1031
|
+
duration.toDays().value; // => 1.127835...
|
|
1032
|
+
duration.toHours().value; // => 27.068057...
|
|
1033
|
+
duration.toMinutes().value; // => 1624.083433...
|
|
1034
|
+
duration.toSeconds().value; // => 97445.006
|
|
1035
|
+
duration.toMilliseconds().value; // => 97445006
|
|
1036
|
+
duration.toMicroseconds().value; // => 97445006000
|
|
1037
|
+
duration.toNanoseconds().value; // => 97445006000000
|
|
1038
|
+
```
|
|
558
1039
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
1040
|
+
### Duration
|
|
1041
|
+
|
|
1042
|
+
The `Duration` object can be directly created not only as a return value of the `subtract` function, but also by passing any numeric value (milliseconds) as a constructor argument.
|
|
1043
|
+
|
|
1044
|
+
```typescript
|
|
1045
|
+
import { Duration } from 'date-and-time';
|
|
1046
|
+
|
|
1047
|
+
const duration = new Duration(123);
|
|
1048
|
+
|
|
1049
|
+
duration.toSeconds().value; // => 0.123
|
|
564
1050
|
```
|
|
565
1051
|
|
|
566
|
-
|
|
1052
|
+
<details>
|
|
1053
|
+
<summary><strong>toDays()</strong></summary>
|
|
567
1054
|
|
|
568
|
-
|
|
569
|
-
- @returns {**boolean**} Whether the year is a leap year
|
|
1055
|
+
This method calculates the number of days in the duration and returns a descriptor that includes the value in days, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
|
|
570
1056
|
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
|
|
1057
|
+
```typescript
|
|
1058
|
+
duration.toDays().value;
|
|
1059
|
+
// => 1.127835...
|
|
1060
|
+
|
|
1061
|
+
duration.toDays().format('D[day], H:mm:ss.SSSfffFFF');
|
|
1062
|
+
// => 1day, 3:04:05.006000000
|
|
1063
|
+
|
|
1064
|
+
duration.toDays().toParts();
|
|
1065
|
+
// => { days: 1, hours: 3, minutes: 4, seconds: 5, ... }
|
|
574
1066
|
```
|
|
575
1067
|
|
|
576
|
-
|
|
1068
|
+
</details>
|
|
577
1069
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
- @returns {**boolean**} Whether the two dates are the same day (time is ignored)
|
|
1070
|
+
<details>
|
|
1071
|
+
<summary><strong>toHours()</strong></summary>
|
|
581
1072
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
1073
|
+
This method calculates the number of hours in the duration and returns a descriptor that includes the value in hours, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
|
|
1074
|
+
|
|
1075
|
+
```typescript
|
|
1076
|
+
duration.toHours().value;
|
|
1077
|
+
// => 27.068057...
|
|
1078
|
+
|
|
1079
|
+
duration.toHours().format('H:mm:ss.SSSfffFFF');
|
|
1080
|
+
// => 27:04:05.006000000
|
|
1081
|
+
|
|
1082
|
+
duration.toHours().toParts();
|
|
1083
|
+
// => { hours: 27, minutes: 4, seconds: 5, ... }
|
|
588
1084
|
```
|
|
589
1085
|
|
|
590
|
-
|
|
1086
|
+
</details>
|
|
1087
|
+
|
|
1088
|
+
<details>
|
|
1089
|
+
<summary><strong>toMinutes()</strong></summary>
|
|
1090
|
+
|
|
1091
|
+
This method calculates the number of minutes in the duration and returns a descriptor that includes the value in minutes, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
|
|
591
1092
|
|
|
592
|
-
|
|
593
|
-
|
|
1093
|
+
```typescript
|
|
1094
|
+
duration.toMinutes().value;
|
|
1095
|
+
// => 1624.083433...
|
|
594
1096
|
|
|
595
|
-
|
|
1097
|
+
duration.toMinutes().format('m[min] ss.SSSfffFFF');
|
|
1098
|
+
// => 1624min 05.006000000
|
|
596
1099
|
|
|
597
|
-
|
|
598
|
-
|
|
1100
|
+
duration.toMinutes().toParts();
|
|
1101
|
+
// => { minutes: 1624, seconds: 5, milliseconds: 6, ... }
|
|
599
1102
|
```
|
|
600
1103
|
|
|
601
|
-
|
|
1104
|
+
</details>
|
|
602
1105
|
|
|
603
|
-
|
|
604
|
-
|
|
1106
|
+
<details>
|
|
1107
|
+
<summary><strong>toSeconds()</strong></summary>
|
|
605
1108
|
|
|
606
|
-
|
|
1109
|
+
This method calculates the number of seconds in the duration and returns a descriptor that includes the value in seconds, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
|
|
1110
|
+
|
|
1111
|
+
```typescript
|
|
1112
|
+
duration.toSeconds().value;
|
|
1113
|
+
// => 97445.006
|
|
1114
|
+
|
|
1115
|
+
duration.toSeconds().format('s[sec] SSSfffFFF');
|
|
1116
|
+
// => 97445sec 006000000
|
|
1117
|
+
|
|
1118
|
+
duration.toSeconds().toParts();
|
|
1119
|
+
// => { seconds: 97445, milliseconds: 6, microseconds: 0, ... }
|
|
607
1120
|
```
|
|
608
1121
|
|
|
609
|
-
|
|
1122
|
+
</details>
|
|
1123
|
+
|
|
1124
|
+
<details>
|
|
1125
|
+
<summary><strong>toMilliseconds()</strong></summary>
|
|
610
1126
|
|
|
611
|
-
|
|
1127
|
+
This method calculates the number of milliseconds in the duration and returns a descriptor that includes the value in milliseconds, a format method for custom formatting, and a toParts method that returns an object with the parts of the duration.
|
|
612
1128
|
|
|
613
|
-
|
|
614
|
-
|
|
1129
|
+
```typescript
|
|
1130
|
+
duration.toMilliseconds().value;
|
|
1131
|
+
// => 97445006
|
|
1132
|
+
|
|
1133
|
+
duration.toMilliseconds().format('S.fffFFF');
|
|
1134
|
+
// => 97445006.000000
|
|
1135
|
+
|
|
1136
|
+
duration.toMilliseconds().toParts();
|
|
1137
|
+
// => { milliseconds: 97445006, microseconds: 0, nanoseconds: 0 }
|
|
1138
|
+
```
|
|
615
1139
|
|
|
616
|
-
|
|
1140
|
+
</details>
|
|
1141
|
+
|
|
1142
|
+
<details>
|
|
1143
|
+
<summary><strong>toMicroseconds()</strong></summary>
|
|
1144
|
+
|
|
1145
|
+
This method calculates the number of microseconds in the duration and returns a descriptor that includes the value in microseconds, a format method for custom formatting, and a toParts method that returns an object with the microseconds and nanoseconds parts.
|
|
1146
|
+
|
|
1147
|
+
```typescript
|
|
1148
|
+
duration.toMicroseconds().value;
|
|
1149
|
+
// => 97445006000
|
|
1150
|
+
|
|
1151
|
+
duration.toMicroseconds().format('f.FFF');
|
|
1152
|
+
// => 97445006000.000
|
|
1153
|
+
|
|
1154
|
+
duration.toMicroseconds().toParts();
|
|
1155
|
+
// => { microseconds: 97445006000, nanoseconds: 0 }
|
|
1156
|
+
```
|
|
617
1157
|
|
|
618
|
-
|
|
1158
|
+
</details>
|
|
619
1159
|
|
|
620
|
-
|
|
621
|
-
|
|
1160
|
+
<details>
|
|
1161
|
+
<summary><strong>toNanoseconds()</strong></summary>
|
|
622
1162
|
|
|
623
|
-
|
|
1163
|
+
This method calculates the number of nanoseconds in the duration and returns a descriptor that includes the value in nanoseconds, a format method for custom formatting, and a toParts method that returns an object with the nanoseconds part.
|
|
624
1164
|
|
|
625
|
-
|
|
1165
|
+
```typescript
|
|
1166
|
+
duration.toNanoseconds().value;
|
|
1167
|
+
// => 97445006000000
|
|
1168
|
+
|
|
1169
|
+
duration.toNanoseconds().format('F[ns]');
|
|
1170
|
+
// => 97445006000000ns
|
|
1171
|
+
|
|
1172
|
+
duration.toNanoseconds().toParts();
|
|
1173
|
+
// => { nanoseconds: 97445006000000 }
|
|
1174
|
+
```
|
|
1175
|
+
|
|
1176
|
+
</details>
|
|
1177
|
+
|
|
1178
|
+
### DurationDescriptor
|
|
1179
|
+
|
|
1180
|
+
#### value
|
|
1181
|
+
|
|
1182
|
+
The value of the duration in the respective unit.
|
|
1183
|
+
|
|
1184
|
+
#### format(formatString[, numeral])
|
|
1185
|
+
|
|
1186
|
+
<details>
|
|
1187
|
+
<summary>Formats the duration according to the provided format string.</summary>
|
|
1188
|
+
|
|
1189
|
+
- formatString
|
|
1190
|
+
- type: `string`
|
|
1191
|
+
- The format string to use for formatting
|
|
1192
|
+
- [numeral]
|
|
1193
|
+
- type: `Numeral`
|
|
1194
|
+
- default: `latn`
|
|
1195
|
+
- Optional numeral object for number formatting
|
|
1196
|
+
|
|
1197
|
+
The tokens available for use in the format string specified as the first argument and their meanings are as follows. However, tokens for units larger than the `DurationDescriptor` cannot be used. For example, in the case of a `DurationDescriptor` obtained by the `toHours` method, the `D` token representing days cannot be used. For a `DurationDescriptor` obtained by the `toNanoseconds` method, only the `F` token representing nanoseconds can be used.
|
|
1198
|
+
|
|
1199
|
+
| Token | Meaning |
|
|
1200
|
+
|:---------|:-----------------------------------|
|
|
1201
|
+
| D | Days |
|
|
1202
|
+
| H | Hours |
|
|
1203
|
+
| m | Minutes |
|
|
1204
|
+
| s | Seconds |
|
|
1205
|
+
| S | Milliseconds |
|
|
1206
|
+
| f | Microseconds |
|
|
1207
|
+
| F | Nanoseconds |
|
|
1208
|
+
|
|
1209
|
+
What makes the format string in `DurationDescriptor` different from others is that repeating the same token produces a zero-padding effect. For example, formatting `1 day` with `DDDD` results in an output of `0001`.
|
|
1210
|
+
|
|
1211
|
+
</details>
|
|
1212
|
+
|
|
1213
|
+
#### toParts()
|
|
1214
|
+
|
|
1215
|
+
<details>
|
|
1216
|
+
<summary>Converts the duration to an object containing the parts of the duration in the respective unit.</summary>
|
|
1217
|
+
|
|
1218
|
+
```typescript
|
|
1219
|
+
{
|
|
1220
|
+
days: 1,
|
|
1221
|
+
hours: 3,
|
|
1222
|
+
minutes: 4,
|
|
1223
|
+
seconds: 5,
|
|
1224
|
+
milliseconds: 6,
|
|
1225
|
+
microseconds: 0,
|
|
1226
|
+
nanoseconds: 0
|
|
1227
|
+
}
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
</details>
|
|
1231
|
+
|
|
1232
|
+
### Notes
|
|
1233
|
+
|
|
1234
|
+
<details>
|
|
1235
|
+
<summary><strong>Negative Duration</strong></summary>
|
|
1236
|
+
|
|
1237
|
+
When the `value` becomes negative, there are slight differences in the output results of the `format` method and the `toParts` method. In the `format` method, only the largest unit in the `DurationDescriptor`, for example, only the `D` token in the case of a `DurationDescriptor` obtained by the `toDays` method, gets a minus sign, while in the `toParts` method, all units get a minus sign.
|
|
1238
|
+
|
|
1239
|
+
```typescript
|
|
1240
|
+
duration.toDays().value;
|
|
1241
|
+
// => -1.127835...
|
|
1242
|
+
|
|
1243
|
+
duration.toDays().format('D[day], H:mm:ss.SSSfffFFF');
|
|
1244
|
+
// => -1day, 3:04:05.006000000
|
|
1245
|
+
|
|
1246
|
+
duration.toDays().toParts();
|
|
1247
|
+
// => { days: -1, hours: -3, minutes: -4, seconds: -5, ... }
|
|
1248
|
+
```
|
|
1249
|
+
|
|
1250
|
+
</details>
|
|
1251
|
+
|
|
1252
|
+
<details>
|
|
1253
|
+
<summary><strong>Negative Zero</strong></summary>
|
|
1254
|
+
|
|
1255
|
+
The `format` method may output `-0`. For example, when the value of a `DurationDescriptor` obtained by the `toDays` method is a negative decimal less than 1, using the `D` token in the `format` method outputs `-0`.
|
|
1256
|
+
|
|
1257
|
+
```typescript
|
|
1258
|
+
duration.toDays().value;
|
|
1259
|
+
// => -0.127835...
|
|
1260
|
+
|
|
1261
|
+
duration.toDays().format('D[day], H:mm:ss.SSSfffFFF');
|
|
1262
|
+
// => -0day, 3:04:05.006000000
|
|
1263
|
+
|
|
1264
|
+
duration.toDays().toParts();
|
|
1265
|
+
// => { days: 0, hours: -3, minutes: -4, seconds: -5, ... }
|
|
1266
|
+
```
|
|
1267
|
+
|
|
1268
|
+
</details>
|
|
1269
|
+
</details>
|
|
1270
|
+
|
|
1271
|
+
## isLeapYear(year)
|
|
1272
|
+
|
|
1273
|
+
<details>
|
|
1274
|
+
<summary>Determines if the specified year is a leap year.</summary>
|
|
1275
|
+
|
|
1276
|
+
- year
|
|
1277
|
+
- type: `number`
|
|
1278
|
+
- The year to check
|
|
1279
|
+
|
|
1280
|
+
```typescript
|
|
1281
|
+
import { isLeapYear } from 'date-and-time';
|
|
1282
|
+
|
|
1283
|
+
isLeapYear(2015); // => false
|
|
1284
|
+
isLeapYear(2012); // => true
|
|
1285
|
+
```
|
|
1286
|
+
|
|
1287
|
+
</details>
|
|
1288
|
+
|
|
1289
|
+
## isSameDay(date1, date2)
|
|
1290
|
+
|
|
1291
|
+
<details>
|
|
1292
|
+
<summary>Determines if two dates represent the same calendar day.</summary>
|
|
1293
|
+
|
|
1294
|
+
- date1
|
|
1295
|
+
- type: `Date`
|
|
1296
|
+
- The first date to compare
|
|
1297
|
+
- date2
|
|
1298
|
+
- type: `Date`
|
|
1299
|
+
- The second date to compare
|
|
1300
|
+
|
|
1301
|
+
```typescript
|
|
1302
|
+
import { isSameDay } from 'date-and-time';
|
|
1303
|
+
|
|
1304
|
+
const date1 = new Date(2017, 0, 2, 0); // Jan 2 2017 00:00:00
|
|
1305
|
+
const date2 = new Date(2017, 0, 2, 23, 59); // Jan 2 2017 23:59:00
|
|
1306
|
+
const date3 = new Date(2017, 0, 1, 23, 59); // Jan 1 2017 23:59:00
|
|
1307
|
+
|
|
1308
|
+
isSameDay(date1, date2); // => true
|
|
1309
|
+
isSameDay(date1, date3); // => false
|
|
1310
|
+
```
|
|
626
1311
|
|
|
627
|
-
|
|
1312
|
+
</details>
|
|
628
1313
|
|
|
629
1314
|
## License
|
|
630
1315
|
|