time-convertor-ts

Convert time across timezones (typescript)
git clone http://git.hanabi.in/repos/time-convertor-ts.git
Log | Files | Refs | README | LICENSE

ShowFuture.tsx (1111B)


      1 import React from "react";
      2 import moment from "moment-timezone";
      3 
      4 import { displayTime, friendlyStr, removeTimeZone } from "../../utils";
      5 import { HMMDY } from "../../utils";
      6 
      7 function ShowFuture({
      8   selectedTime,
      9   zones,
     10 }: {
     11   selectedTime: moment.Moment;
     12   zones: string[];
     13 }): JSX.Element {
     14   return (
     15     <>
     16       <h3 className="mt-5 mb-3">In other time zones...</h3>
     17       <ul className="list-group">
     18         {zones.map((zone) => (
     19           <li
     20             className="list-group-item list-group-item-action"
     21             key={zone}
     22             style={{ cursor: "pointer" }}
     23           >
     24             <h4>{friendlyStr(zone)}</h4>
     25             <span>
     26               {displayTime({
     27                 fmtStr: HMMDY,
     28                 time: selectedTime,
     29                 timezone: zone,
     30               })}
     31             </span>
     32             <button
     33               className="btn btn-danger float-right"
     34               onClick={() => removeTimeZone(zone)}
     35               type="button"
     36             >
     37               Remove
     38             </button>
     39           </li>
     40         ))}
     41       </ul>
     42     </>
     43   );
     44 }
     45 
     46 export default ShowFuture;